Skip to content

Latest commit

 

History

History

trustless-pathing

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Trustless Pathing Fixtures for JS

import {
  unixfs20mVarietyCases,
  unixfs20mVarietyCar
} from '@ipld/specs/trustless-pathing/unixfs_20m_variety'

const testCases = unixfs20mVarietyCases()
const carUrl = unixfs20mVarietyCar()

// load the CAR using @ipld/car streamed from `carUrl` as a file
// use `testCases` to run the tests

unixfs20mVarietyCases() returns an array of test cases that look like this:

class TestCase {
    name: string
    root: CID
    path: string
    scope: string
    duplicates: boolean
    byteRange: string
    expectedCids: CID[]
}

TestCase#asQuery() will print a Trustless Gateway style URL string representing the case, e.g.:

console.log(tc.asQuery())
// -> /ipfs/bafybeifrrglx2issn2had5rtstn3xltla6vxmpjfwfz7o3hapvkynh4zoq/clippet.txt?dag-scope=entity&entity-bytes=0:256144