Files
backend/src/modules/investments/operations/application/local-operations-cursor.codec.spec.ts
T
codex-bot cd78b43783
Backend verify / commits (push) Skipped
Backend verify / security (push) Successful in 1m11s
Backend verify / verify (push) Failing after 7m17s
refactor: split brokerage operations repository and cursor codec (WealthLedger/backend#167) (#190)
2026-11-04 22:01:02 +03:00

24 lines
744 B
TypeScript

import { decode, encode } from './local-operations-cursor.codec';
const secret = 'secret';
const cursor = {
accountId: 'account',
at: '2026-01-01T00:00:00.000Z',
binding: 'owner-filter-binding',
id: 'operation',
movingEnd: false,
to: '2026-02-01T00:00:00.000Z',
};
describe('local operations cursor', () => {
it('roundtrips the opaque cursor, including its owner and filter binding', () => {
expect(decode(encode(cursor, secret), secret)).toEqual(cursor);
});
it('rejects a tampered cursor and a cursor signed with a different key', () => {
const encoded = encode(cursor, secret);
expect(() => decode(`${encoded}x`, secret)).toThrow();
expect(() => decode(encoded, 'different-secret')).toThrow();
});
});