From 890d6be2508ae09c95d2e4fb3ee3f92db7a2e00f Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 4 Aug 2023 13:46:14 +0200 Subject: [PATCH] feat: add 404 test for trustless gateway car --- tests/trustless_gateway_car_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/trustless_gateway_car_test.go b/tests/trustless_gateway_car_test.go index a81bb772e..251788b36 100644 --- a/tests/trustless_gateway_car_test.go +++ b/tests/trustless_gateway_car_test.go @@ -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(flattenStrings(t, + subdirTwoSingleBlockFilesFixture.MustGetCid(), + subdirTwoSingleBlockFilesFixture.MustGetCid("subdir"), + )...). + Exactly(). + InThatOrder(), + ), + }, } RunWithSpecs(t, helpers.StandardCARTestTransforms(t, tests), specs.TrustlessGatewayCAR)