Test first: redeem refuses a target the completion never recorded
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b446add144
commit
a021b02310
1 changed files with 10 additions and 0 deletions
|
|
@ -218,6 +218,16 @@ describe("redeem binds caller, target and replay", () => {
|
|||
expect((await redeem(r, { completionCode, targetId: "target-a" }, appAuth)).statusCode).toBe(201);
|
||||
});
|
||||
|
||||
it("refuses a target named against a completion that recorded none, without consuming the code", async () => {
|
||||
const r = await rig("d-r2b");
|
||||
const completionCode = await linked(r, undefined);
|
||||
const refused = await redeem(r, { completionCode, targetId: "target-a" }, appAuth);
|
||||
expect([refused.statusCode, refused.json().error]).toEqual([403, "completion_target_mismatch"]);
|
||||
expect(refused.json().accessToken).toBeUndefined();
|
||||
expect((await r.store.findAuthCompletion("repixelizer", completionCode))?.consumedAt).toBeUndefined();
|
||||
expect((await redeem(r, { completionCode }, appAuth)).statusCode).toBe(201);
|
||||
});
|
||||
|
||||
it("refuses a replayed completion", async () => {
|
||||
const r = await rig("d-r3");
|
||||
const completionCode = await linked(r, "target-a");
|
||||
|
|
|
|||
Loading…
Reference in a new issue