import * as Value from './Value.js' describe('blockToIso', () => { test('prefers the millisecond timestamp on a raw header', () => { expect( Value.blockToIso({ timestamp: '0x6a7b5571', timestampMillis: '0x19ff1c5c312' }), ).toMatchInlineSnapshot(`"2026-08-11T17:01:37.426Z"`) }) test('falls back to whole seconds when the millisecond timestamp is absent', () => { expect(Value.blockToIso({ timestamp: '0x6a7b5571' })).toMatchInlineSnapshot( `"2026-08-11T17:01:37.000Z"`, ) }) test('reads a viem-formatted header', () => { expect( Value.blockToIso({ timestamp: 1_786_467_697n, timestampMillis: '0x19ff1c5c312' }), ).toMatchInlineSnapshot(`"2026-08-11T17:01:37.426Z"`) }) test('returns undefined without a usable timestamp', () => { expect(Value.blockToIso(undefined)).toMatchInlineSnapshot(`undefined`) expect(Value.blockToIso({ timestamp: null })).toMatchInlineSnapshot(`undefined`) }) }) describe('tokenAmount', () => { test('renders a self-contained token quantity', () => { expect( Value.tokenAmount({ baseUnits: '1234567', currency: 'USD', decimals: 6, }), ).toMatchInlineSnapshot(` { "baseUnits": "1234567", "currency": "USD", "decimals": 6, "formatted": "1.234567", } `) }) })