Skip to content

Commit

Permalink
feat: add 404 test for trustless gateway car
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Aug 18, 2023
1 parent 919eda1 commit 6214629
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/trustless_gateway_car_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,30 @@ func TestTrustlessCarPathing(t *testing.T) {
InThatOrder(),
),
},
{
Name: "GET default CAR response for non-existing file",
Hint: `
CAR stream of a non-existing path must return 200 OK and all the blocks necessary
to traverse the path up to and including the parent of the first non-existing
segment of the path, in order to allow the client to verify that the request
path does not exist.
`,
Request: Request().
Path("/ipfs/{{cid}}/subdir/i-do-not-exist", subdirTwoSingleBlockFilesFixture.MustGetCidWithCodec(0x70)).
Query("format", "car"),
Response: Expect().
Status(200).
Body(
IsCar().
IgnoreRoots().
HasBlocks(
subdirTwoSingleBlockFilesFixture.MustGetCid(),
subdirTwoSingleBlockFilesFixture.MustGetCid("subdir"),
).
Exactly().
InThatOrder(),
),
},
}

RunWithSpecs(t, helpers.StandardCARTestTransforms(t, tests), specs.TrustlessGatewayCAR)
Expand Down

0 comments on commit 6214629

Please sign in to comment.