Skip to content

Commit a68f76d

Browse files
committed
Fix tests by replacing legacy sample receipt dependency
1 parent ca93c18 commit a68f76d

4 files changed

Lines changed: 38 additions & 8 deletions

File tree

tests/api-agents-verifyagent.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ function makeRes() {
1919
}
2020

2121
const sampleReceipt = JSON.parse(
22-
fs.readFileSync(path.join(__dirname, '..', 'examples', 'sample-receipt.json'), 'utf8')
22+
fs.readFileSync(path.join(__dirname, 'fixtures', 'canonical-receipt.sample.json'), 'utf8')
2323
);
2424

25-
test('POST /api/agents/verifyagent with legacy sample => INVALID', async () => {
25+
test('POST /api/agents/verifyagent with canonical sample fixture => INVALID', async () => {
2626
const req = { method: 'POST', body: { task: 'verify this receipt', receipt: sampleReceipt } };
2727
const res = makeRes();
2828

tests/api-verify.test.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ function makeRes() {
1919
}
2020

2121
const sampleReceipt = JSON.parse(
22-
fs.readFileSync(path.join(__dirname, '..', 'examples', 'sample-receipt.json'), 'utf8')
22+
fs.readFileSync(path.join(__dirname, 'fixtures', 'canonical-receipt.sample.json'), 'utf8')
2323
);
2424

25-
test('POST /api/verify with legacy sample => INVALID', async () => {
25+
test('POST /api/verify with canonical sample fixture => INVALID', async () => {
2626
const req = { method: 'POST', body: sampleReceipt };
2727
const res = makeRes();
2828

@@ -31,12 +31,11 @@ test('POST /api/verify with legacy sample => INVALID', async () => {
3131
assert.equal(res.statusCode, 200);
3232
assert.equal(res.body.ok, false);
3333
assert.equal(res.body.status, 'INVALID');
34-
assert.equal(res.body.debug.has_legacy_top_level_proof, true);
35-
});
34+
});
3635

3736

3837

39-
test('POST /api/verify with wrapped legacy receipt payload => INVALID', async () => {
38+
test('POST /api/verify with wrapped canonical sample payload => INVALID', async () => {
4039
const req = { method: 'POST', body: { receipt: sampleReceipt } };
4140
const res = makeRes();
4241

tests/commons-flow.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ test('canonicalReceiptPayload: extracts only the six canonical fields', () => {
8686
});
8787

8888
test('sha256 of canonicalized payload matches known sample-receipt hash', () => {
89-
// These values are taken from examples/sample-receipt.json
89+
// These values are taken from tests/fixtures/canonical-receipt.sample.json
9090
const receipt = {
9191
signer: 'runtime.commandlayer.eth',
9292
verb: 'agent.execute',
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"signer": "runtime.commandlayer.eth",
3+
"verb": "agent.execute",
4+
"ts": "2026-05-20T00:00:00.000Z",
5+
"input": {
6+
"task": "verify",
7+
"content": "canonical"
8+
},
9+
"output": {
10+
"ok": true
11+
},
12+
"execution": {
13+
"runtime": "prod",
14+
"run_id": "run_1"
15+
},
16+
"metadata": {
17+
"proof": {
18+
"canonicalization": "json.sorted_keys.v1",
19+
"hash": {
20+
"alg": "SHA-256",
21+
"value": "8035378e3f1f4d2ae3f5c8f4a8767e8fc99695f5f3d17d5d49f75f53dceb0f73"
22+
},
23+
"signature": {
24+
"alg": "Ed25519",
25+
"kid": "vC4WbcNoq2znSCiQ",
26+
"value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
27+
},
28+
"signer_id": "runtime.commandlayer.eth"
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)