Skip to content

Commit 4e8549a

Browse files
committed
test(server): compare the attachment redirect without a second clock read
1 parent 58e357f commit 4e8549a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎apps/server/src/server.test.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5540,10 +5540,12 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
55405540
});
55415541
const response = yield* fetchEffect(issued.relativeUrl, { redirect: "manual" });
55425542
assert.equal(response.status, 302);
5543-
assert.equal(
5544-
response.headers.location,
5545-
fakeSignedAttachmentDownload(url, yield* Clock.currentTimeMillis),
5546-
);
5543+
// The stub dates its signature when the route asks, so compare the parts
5544+
// that do not depend on the clock.
5545+
const location = new URL(response.headers.location ?? "");
5546+
assert.equal(location.origin + location.pathname, "https://signed.example/download");
5547+
assert.equal(location.searchParams.get("for"), url);
5548+
assert.equal(location.searchParams.get("X-Amz-Expires"), "300");
55475549
assert.match(response.headers["cache-control"] ?? "", /^private, max-age=2[0-9]{2}$/);
55485550

55495551
const missing = yield* client[WS_METHODS.assetsCreateUrl]({

0 commit comments

Comments
 (0)