Skip to content

Commit

Permalink
test: add interop test for unixfs directory redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Mar 25, 2024
1 parent 225ebeb commit 3661cf3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/interop/src/unixfs-dir.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,25 @@ describe('@helia/verified-fetch - unixfs directory', () => {
await verifiedFetch.stop()
})

describe('unixfs-dir-redirect', () => {
before(async () => {
await loadFixtureDataCar(controller, 'gateway-conformance-fixtures.car')
});

[
'https://example.com/ipfs/bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q',
'ipfs://bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q',
'http://example.com/ipfs/bafybeifq2rzpqnqrsdupncmkmhs3ckxxjhuvdcbvydkgvch3ms24k5lo7q'
].forEach((url: string) => {
it(`request to unixfs directory with ${url} should return a 301 with a trailing slash`, async () => {
const response = await verifiedFetch(url, { redirect: 'manual' })
expect(response).to.be.ok()
expect(response.status).to.equal(301)
expect(response.headers.get('location')).to.equal(`${url}/`)
})
})
})

describe('XKCD Barrel Part 1', () => {
before(async () => {
// This is the content of https://explore.ipld.io/#/explore/QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm/1%20-%20Barrel%20-%20Part%201
Expand Down

0 comments on commit 3661cf3

Please sign in to comment.