← All showcases
testingtraceability

Test explanation

Tests linked to what they prove — semantics above assertion strings.

session_expiry {
    expired tokens must reject requests
    proven by ["./auth.test.ts".rejectsExpiredToken]
}

auth.test.ts

test("rejectsExpiredToken", async () => {
  const res = await request(app)
    .get("/me")
    .set("Authorization", `Bearer ${expired}`);
  expect(res.status).toBe(401);
});

what the test proves

  • Expired JWT returns 401
  • Refresh flow is not attempted for expired access tokens