apps/gateway/src/tests/idempotency.test.ts
Metadata
- Purpose: Source artifact in the anchor-msp system.
- Domain:
applications - Language:
ts - Bytes: 548
- Lines: 22
- Content hash (short):
65b98f6d - Source (start): apps/gateway/src/tests/idempotency.test.ts:1
- Source (end): apps/gateway/src/tests/idempotency.test.ts:22
Indexed Symbols
No indexed functions/methods detected in this file.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
import { test } from "node:test";
import assert from "node:assert/strict";
import { getIdempotencyKey } from "../utils/idempotency.js";
test("getIdempotencyKey accepts valid token", () => {
const request = {
headers: {
"idempotency-key": "abc12345-ops"
}
};
assert.equal(getIdempotencyKey(request as any), "abc12345-ops");
});
test("getIdempotencyKey rejects invalid token", () => {
const request = {
headers: {
"idempotency-key": "bad key"
}
};
assert.throws(() => getIdempotencyKey(request as any));
});