mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-12-03 12:32:02 +00:00
test(serve): pin the output memo to returning the stored string
A memo hit must not re-render. The generated stamp is minted per render, so asserting it is unchanged across the hit states that contract directly instead of leaving it implied by byte equality.
This commit is contained in:
parent
966454d774
commit
0bed44fec8
1 changed files with 5 additions and 0 deletions
|
|
@ -281,6 +281,11 @@ describe('codeburn serve --stdio', () => {
|
|||
const sameBytes = await request(110, args)
|
||||
expect(sameBytes['ok']).toBe(true)
|
||||
expect(sameBytes['output']).toBe(memoized!['output'])
|
||||
// `generated` is minted per render, so an unchanged stamp is the proof
|
||||
// that a memo hit returns the stored string instead of re-rendering.
|
||||
const stamp = (res: Record<string, unknown>): string =>
|
||||
(JSON.parse(res['output'] as string) as { generated: string }).generated
|
||||
expect(stamp(sameBytes)).toBe(stamp(memoized!))
|
||||
|
||||
// Same byte length as USD: a size-only fingerprint would miss this.
|
||||
await writeFile(configPath, JSON.stringify({ currency: { code: 'EUR' } }), 'utf8')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue