Skip to content
Source
Sign inSign up
TanStack/schemas
Open History to see the last commit

evaluate.test.ts

682 lines20.7 KB

1import { describe, expect, it } from 'vitest'
2import {
3 RateCardError,
4 bindInputs,
5 cardCurrency,
6 cardParams,
7 cardPrice,
8 price,
9 priceDetailed,
10 verifyExamples,
11} from './evaluate.ts'
12import { z } from 'zod'
13​
14import { CORE_OPS } from './card.ts'
15import { rateCardSchema } from './rate-card.schema.ts'
16import type { Expr, RateCard } from './card.ts'
17import { compileTokenCard } from './token-card.ts'
18​
19const source = {
20 url: 'https://example.test/llms.txt',
21 hash: 'a'.repeat(64),
22 extractedAt: '2026-09-13T00:00:00Z',
24​
25/** A card whose price is `expr`, over number inputs `x` (default 4) and `y` (default 2). */
26const cardFor = (expr: Expr, extra: Partial<RateCard> = {}): RateCard => ({
27 inputs: {
28 x: { param: 'x', kind: 'number', default: 4 },
29 y: { param: 'y', kind: 'number', default: 2 },
30 },
31 tables: { t: { a: { p: 1.5 }, b: { p: 3 } } },
32 price: expr,
33 examples: [],
34 source,
35 ...extra,
36})
37​
38const usd = (expr: Expr, params: Record<string, unknown> = {}) =>
39 price(cardFor(expr), params)
40​
41describe('ops', () => {
42 it.each<[string, Expr, number]>([
43 ['+ variadic', { '+': [{ var: 'x' }, { var: 'y' }, 1] }, 7],
44 ['- binary', { '-': [{ var: 'x' }, { var: 'y' }] }, 2],
45 ['* variadic', { '*': [{ var: 'x' }, { var: 'y' }, 0.5] }, 4],
46 ['/', { '/': [{ var: 'x' }, { var: 'y' }] }, 2],
47 ['max', { max: [1, { var: 'x' }, 3] }, 4],
48 ['min', { min: [{ var: 'x' }, 3, { var: 'y' }] }, 2],
49 ['ceil', { ceil: [{ '/': [{ var: 'x' }, 3] }] }, 2],
50 ['floor', { floor: [{ '/': [{ var: 'x' }, 3] }] }, 1],
51 [
52 'if chain',
53 {
54 if: [
55 { '<': [{ var: 'x' }, 2] },
56 10,
57 { '<': [{ var: 'x' }, 5] },
58 20,
59 30,
60 ],
61 },
62 20,
63 ],
64 ['== literal', { if: [{ '==': [{ var: 'x' }, 4] }, 1, 2] }, 1],
65 ['!=', { if: [{ '!=': [{ var: 'x' }, 4] }, 1, 2] }, 2],
66 ['<=', { if: [{ '<=': [{ var: 'x' }, 4] }, 1, 2] }, 1],
67 ['>', { if: [{ '>': [{ var: 'x' }, 4] }, 1, 2] }, 2],
68 ['>=', { if: [{ '>=': [{ var: 'x' }, 4] }, 1, 2] }, 1],
69 ['and', { if: [{ and: [true, { '>': [{ var: 'x' }, 1] }] }, 1, 2] }, 1],
70 ['or', { if: [{ or: [false, { '>': [{ var: 'x' }, 1] }] }, 1, 2] }, 1],
71 [
72 'missing → falsy when nothing is missing',
73 { if: [{ missing: ['x'] }, 1, 2] },
74 2,
75 ],
76 [
77 'missing → truthy when something is',
78 { if: [{ missing: ['x', 'nope'] }, 1, 2] },
79 1,
80 ],
81 ['lookup nested', { lookup: { table: 't', keys: ['b', 'p'] } }, 3],
82 [
83 'lookup default',
84 { lookup: { table: 't', keys: ['zzz'], default: 9 } },
85 9,
86 ],
87 ])('%s', (_name, expr, expected) => {
88 expect(usd(expr)).toBe(expected)
89 })
90})
91​
92describe('binding', () => {
93 const card: RateCard = {
94 inputs: {
95 duration: { param: 'duration', kind: 'number', default: 5 },
96 res: {
97 param: 'resolution',
98 kind: 'enum',
99 values: ['480p', '720p'],
100 default: '480p',
101 },
102 audio: { param: 'generate_audio', kind: 'boolean', default: true },
103 refs: { param: 'image_urls', kind: 'count' },
104 size: {
105 param: 'image_size',
106 kind: 'dimensions',
107 presets: { square_hd: [1024, 1024] },
108 default: 'square_hd',
109 },
110 },
111 tables: {},
112 price: 1,
113 examples: [],
114 source,
115 }
116​
117 it('binds by request param name, falling back to defaults', () => {
118 expect(bindInputs(card, {})).toEqual({
119 duration: 5,
120 res: '480p',
121 audio: true,
122 refs: 0,
123 size: { width: 1024, height: 1024 },
124 })
125 })
126​
127 it('reads a numeric string duration, a list length and explicit pixels', () => {
128 expect(
129 bindInputs(card, {
130 duration: '8',
131 resolution: '720p',
132 generate_audio: false,
133 image_urls: ['a', 'b'],
134 image_size: { width: 1920, height: 1080 },
135 }),
136 ).toEqual({
137 duration: 8,
138 res: '720p',
139 audio: false,
140 refs: 2,
141 size: { width: 1920, height: 1080 },
142 })
143 })
144​
145 it('reads WxH as pixels and a level by name', () => {
146 const c: RateCard = {
147 ...card,
148 inputs: {
149 ...card.inputs,
150 size: { param: 'image_size', kind: 'dimensions', levels: ['2K'] },
151 },
152 }
153 expect(bindInputs(c, { image_size: '2048x1152' }).size).toEqual({
154 width: 2048,
155 height: 1152,
156 })
157 expect(bindInputs(c, { image_size: '2K' }).size).toEqual({ level: '2K' })
158 expect(() => bindInputs(c, { image_size: '4K' })).toThrow(RateCardError)
159 })
160​
161 it('var walks dotted paths into dimensions', () => {
162 const c: RateCard = {
163 ...card,
164 price: { '*': [{ var: 'size.width' }, 0.001] },
165 }
166 expect(price(c, {})).toBe(1.024)
167 })
168​
169 it.each<[string, Record<string, unknown>]>([
170 ['enum outside values', { resolution: '1080p' }],
171 ['non-numeric number', { duration: 'five' }],
172 ['non-boolean boolean', { generate_audio: 'yes' }],
173 ['non-list count', { image_urls: 'a' }],
174 ['unknown size preset', { image_size: 'portrait_4_3' }],
175 ])('refuses %s', (_name, params) => {
176 expect(() => price(card, params)).toThrow(RateCardError)
177 })
178})
179​
180/** Outside the vocabulary; parsed so no assertion has to lie about its type. */
181const unknownOp = JSON.parse('{"cat":[1,2]}') as Expr
182​
183describe('refusals', () => {
184 it.each<[string, Expr, string]>([
185 ['unknown op', unknownOp, 'unknown-op'],
186 ['unbound var', { var: 'nope' }, 'unbound-var'],
187 [
188 'missing lookup key without default',
189 { lookup: { table: 't', keys: ['zzz', 'p'] } },
190 'missing-key',
191 ],
192 ['non-numeric operand', { '+': [{ var: 'x' }, 'text'] }, 'not-a-number'],
193 // JSONLogic's == is loose; ours refuses a type mismatch instead of returning false.
194 [
195 '== across types',
196 { if: [{ '==': [{ var: 'x' }, '4'] }, 1, 2] },
197 'not-comparable',
198 ],
199 [
200 '!= across types',
201 { if: [{ '!=': [{ var: 'x' }, '4'] }, 1, 2] },
202 'not-comparable',
203 ],
204 [
205 '== on a list',
206 { if: [{ '==': [{ missing: ['x'] }, 0] }, 1, 2] },
207 'not-comparable',
208 ],
209 ['zero price', { '-': [{ var: 'x' }, 4] }, 'bad-result'],
210 ['negative price', { '-': [1, { var: 'x' }] }, 'bad-result'],
211 ['non-finite price', { '/': [{ var: 'x' }, 0] }, 'bad-result'],
212 ['non-numeric price', { '<': [1, 2] }, 'bad-result'],
213 ])('%s', (_name, expr, code) => {
214 expect(() => usd(expr)).toThrow(expect.objectContaining({ code }))
215 })
216​
217 const doubleX: Expr = { '*': [{ var: 'x' }, 2] }
218 const yuan = { ...cardFor(doubleX), price: { currency: ['CNY', doubleX] } }
219​
220 it('accepts source-published literal free prices in USD and CNY', () => {
221 const free = cardFor(0, { inputs: {}, tables: {} })
222 expect(priceDetailed(rateCardSchema.parse(free))).toEqual({
223 amount: 0,
224 currency: 'USD',
225 usd: 0,
226 estimated: [],
227 defaulted: [],
228 ignored: [],
229 })
230 const cny = rateCardSchema.parse({
231 ...free,
232 price: { currency: ['CNY', 0] },
233 })
234 expect(priceDetailed(cny)).toEqual({
235 amount: 0,
236 currency: 'CNY',
237 estimated: [],
238 defaulted: [],
239 ignored: [],
240 })
241 expect(price(cny)).toBe(0)
242 })
243​
244 it('rejects negative native currency and computed zero paid prices', () => {
245 const negative = rateCardSchema.parse({
246 ...cardFor(1),
247 price: { currency: ['CNY', -1] },
248 })
249 expect(() => price(negative)).toThrow(
250 expect.objectContaining({ code: 'bad-result' }),
251 )
252 const paid = rateCardSchema.parse(yuan)
253 expect(() => price(paid, { x: 0 })).toThrow(
254 expect.objectContaining({ code: 'bad-result' }),
255 )
256 })
257​
258 it('prices a card in its own currency and never calls it USD', () => {
259 const parsed = rateCardSchema.parse(yuan)
260 expect(cardCurrency(parsed)).toBe('CNY')
261 expect(priceDetailed(parsed)).toEqual({
262 amount: 8,
263 currency: 'CNY',
264 estimated: [],
265 defaulted: ['x', 'y'],
266 ignored: [],
267 })
268 // The wrapper changes the label, never the amount.
269 expect(price(parsed)).toBe(price(cardFor(doubleX)))
270 // A bare price is USD: a card stored before currencies reads unchanged.
271 expect(cardCurrency(cardFor(1))).toBe('USD')
272 expect(priceDetailed(cardFor(1))).toMatchObject({ currency: 'USD', usd: 1 })
273 })
274​
275 it.each(['yuan', 'cny', '¥', 'RMBX', ''])(
276 'schema rejects %j as a currency',
277 (currency) => {
278 const card = { ...cardFor(1), price: { currency: [currency, 1] } }
279 expect(rateCardSchema.safeParse(card).success).toBe(false)
280 },
281 )
282​
283 it('schema takes the currency wrapper at the root of price only', () => {
284 const nested = { '+': [1, { currency: ['CNY', 1] }] }
285 expect(
286 rateCardSchema.safeParse({ ...cardFor(1), price: nested }).success,
287 ).toBe(false)
288 const beside = { currency: ['CNY', 1], '+': [1, 2] }
289 expect(
290 rateCardSchema.safeParse({ ...cardFor(1), price: beside }).success,
291 ).toBe(false)
292 })
293​
294 it('schema refuses a top-level currency rather than read the card as USD', () => {
295 for (const currency of ['CNY', 'USD', null, 156]) {
296 expect(
297 rateCardSchema.safeParse({ ...cardFor(1), currency }).success,
298 ).toBe(false)
299 }
300 })
301​
302 it('schema refuses a USD wrapper: USD is said only by having none', () => {
303 const card = { ...cardFor(1), price: { currency: ['USD', 1] } }
304 expect(rateCardSchema.safeParse(card).success).toBe(false)
305 })
306​
307 // Wrappers the schema refuses, handed to the evaluator unparsed.
308 it.each([
309 ['a lowercase code', { currency: ['cny', 1] }],
310 ['a numeric code', { currency: [156, 1] }],
311 ['USD', { currency: ['USD', 1] }],
312 ['three items', { currency: ['CNY', 1, 2] }],
313 ['a sibling op', { currency: ['CNY', 1], '+': [1, 2] }],
314 ['a bare code', { currency: 'CNY' }],
315 ['no price', undefined],
316 ['a null price', null],
317 ['a null wrapper payload', { currency: null }],
318 ['a null wrapped expression', { currency: ['CNY', null] }],
319 ])('evaluator refuses %s with its own error', (_name, bad) => {
320 const card = { ...cardFor(1), price: bad } as unknown as RateCard
321 expect(rateCardSchema.safeParse(card).success).toBe(false)
322 for (const read of [cardPrice, cardCurrency, price, priceDetailed]) {
323 expect(() => read(card)).toThrow(RateCardError)
324 expect(() => read(card)).toThrow(
325 expect.objectContaining({ code: 'unknown-op' }),
326 )
327 }
328 })
329​
330 it('evaluator refuses a stray top-level currency on an unparsed card', () => {
331 const card = { ...cardFor(1), currency: 'CNY' } as unknown as RateCard
332 for (const read of [cardCurrency, price, priceDetailed]) {
333 expect(() => read(card)).toThrow(
334 expect.objectContaining({ code: 'unknown-op' }),
335 )
336 }
337 })
338​
339 it('evaluator refuses a null card with its own error', () => {
340 expect(() => cardCurrency(null as unknown as RateCard)).toThrow(
341 RateCardError,
342 )
343 })
344​
345 /**
346 * What @modelschemas/rate-card 0.1.0 (and a service rolled back to before
347 * currencies) does with an expression node: its schema accepts only the
348 * ops below, and its evaluator throws `unknown-op` on any other key. The
349 * op list is the published one, frozen here on purpose.
350 */
351 const OPS_0_1_0 = [
352 ...['var', 'missing', '+', '-', '*', '/', 'max', 'min', 'if'],
353 ...['==', '!=', '<', '<=', '>', '>=', 'and', 'or', 'ceil', 'floor'],
354 ]
355 const expr010: z.ZodType = z.lazy(() =>
356 z.union([
357 z.number(),
358 z.string(),
359 z.boolean(),
360 z.strictObject({ lookup: z.unknown() }),
361 z
362 .partialRecord(z.enum(OPS_0_1_0), z.union([expr010, z.array(expr010)]))
363 .refine((ops) => Object.keys(ops).length === 1, 'one op per node'),
364 ]),
365 )
366​
367 it('a pre-currency evaluator refuses a non-USD card instead of calling it dollars', () => {
368 // It reads USD cards as before, so the reproduction is not just strict.
369 expect(expr010.safeParse(doubleX).success).toBe(true)
370 expect(expr010.safeParse(yuan.price).success).toBe(false)
371 // Its evaluator would throw `unknown-op` on the root key.
372 expect(Object.keys(yuan.price)).toEqual(['currency'])
373 expect(OPS_0_1_0).not.toContain('currency')
374 // The op must never become a core op, or old schemas that are handed
375 // the new list would start reading yuan as dollars.
376 expect(CORE_OPS).toEqual(OPS_0_1_0)
377 })
378​
379 it('schema rejects an op outside the vocabulary', () => {
380 expect(rateCardSchema.safeParse(cardFor(unknownOp)).success).toBe(false)
381 })
382​
383 it('schema rejects a lookup node carrying a sibling op (would be stripped silently)', () => {
384 const expr = JSON.parse(
385 '{"lookup":{"table":"t","keys":["a","p"]},"+":[1,2]}',
386 ) as Expr
387 expect(rateCardSchema.safeParse(cardFor(expr)).success).toBe(false)
388 })
389​
390 it.each<[string, Partial<RateCard>]>([
391 [
392 'enum default outside values',
393 {
394 inputs: {
395 r: { param: 'r', kind: 'enum', values: ['a'], default: 'zzz' },
396 },
397 },
398 ],
399 [
400 'dimensions default that is not a preset',
401 {
402 inputs: {
403 s: { param: 's', kind: 'dimensions', presets: {}, default: 'nope' },
404 },
405 },
406 ],
407 [
408 'extractedAt that is not a date',
409 { source: { ...source, extractedAt: 'yesterday' } },
410 ],
411 [
412 'expiresAt that is not a date',
413 { source: { ...source, expiresAt: 'soon' } },
414 ],
415 ])('schema rejects %s', (_name, extra) => {
416 expect(rateCardSchema.safeParse(cardFor(1, extra)).success).toBe(false)
417 })
418})
419​
420describe('verifyExamples', () => {
421 const expr: Expr = { '*': [{ var: 'x' }, 0.1] }
422 it('passes within 1% and fails outside it, reporting the priced USD', () => {
423 const card = cardFor(expr, {
424 examples: [
425 { params: { x: 10 }, usd: 1.0, quote: 'ten' },
426 { params: { x: 10 }, usd: 1.009, quote: 'ten-ish' },
427 { params: { x: 10 }, usd: 1.02, quote: 'not ten' },
428 ],
429 })
430 const [exact, close, off] = verifyExamples(card)
431 expect(exact).toMatchObject({ ok: true, usd: 1 })
432 expect(close).toMatchObject({ ok: true })
433 expect(off).toMatchObject({
434 ok: false,
435 usd: 1,
436 error: expect.stringContaining('1.02') as string,
437 })
438 })
439​
440 it('reports a refusal as a failed example instead of throwing', () => {
441 const card = cardFor(expr, {
442 examples: [{ params: { x: 'many' }, usd: 1, quote: 'bad input' }],
443 })
444 expect(verifyExamples(card)[0]).toMatchObject({
445 ok: false,
446 error: expect.stringContaining('bad-input') as string,
447 })
448 })
449})
450​
451describe('estimate', () => {
452 // rate × tokens; tokens estimated as seconds × per-second[resolution].
453 const card: RateCard = {
454 inputs: {
455 resolution: { param: 'resolution', kind: 'enum', values: ['480p'] },
456 tokens: {
457 param: 'tokens',
458 bound: 'usage',
459 kind: 'number',
460 estimate: {
461 inputs: { seconds: { param: 'seconds', kind: 'number' } },
462 value: {
463 '*': [
464 { var: 'seconds' },
465 {
466 lookup: { table: 'per_second', keys: [{ var: 'resolution' }] },
467 },
468 ],
469 },
470 source: { url: 'https://example.test/guide', hash: 'b'.repeat(64) },
471 },
472 },
473 },
474 tables: { per_second: { '480p': 1000 } },
475 price: { '*': [{ var: 'tokens' }, 0.001] },
476 examples: [],
477 source,
478 }
479​
480 it('prices supplied usage as billed, without the estimate inputs', () => {
481 expect(rateCardSchema.parse(card)).toEqual(card)
482 expect(
483 priceDetailed(card, { resolution: '480p' }, { tokens: 500 }),
484 ).toEqual({
485 amount: 0.5,
486 currency: 'USD',
487 usd: 0.5,
488 estimated: [],
489 defaulted: [],
490 ignored: [],
491 })
492 })
493​
494 it('labels an estimated input and binds its own inputs only then', () => {
495 expect(priceDetailed(card, { resolution: '480p', seconds: 2 }, {})).toEqual(
496 {
497 amount: 2,
498 currency: 'USD',
499 usd: 2,
500 estimated: ['tokens'],
501 defaulted: [],
502 ignored: [],
503 },
504 )
505 expect(() => priceDetailed(card, { resolution: '480p' }, {})).toThrow(
506 /tokens \(tokens\): not supplied, and cannot be estimated.*seconds.*required/,
507 )
508 })
509​
510 it('never estimates through price(), the billed entry point', () => {
511 expect(price(card, { resolution: '480p' }, { tokens: 500 })).toBe(0.5)
512 expect(() => price(card, { resolution: '480p', seconds: 2 }, {})).toThrow(
513 /tokens \(tokens\): required/,
514 )
515 })
516​
517 it('refuses a non-positive estimate rather than pricing it', () => {
518 expect(() =>
519 priceDetailed(card, { resolution: '480p', seconds: -1 }, {}),
520 ).toThrow(
521 expect.objectContaining({ code: 'estimate-unavailable' }) as Error,
522 )
523 })
524​
525 it('rejects an estimate beside a default, or shadowing a card input', () => {
526 const tokens = card.inputs.tokens
527 if (tokens?.kind !== 'number' || !tokens.estimate) throw new Error('shape')
528 const withDefault = {
529 ...card,
530 inputs: { ...card.inputs, tokens: { ...tokens, default: 1 } },
531 }
532 expect(rateCardSchema.safeParse(withDefault).success).toBe(false)
533 const shadowing = {
534 ...card,
535 inputs: {
536 ...card.inputs,
537 tokens: {
538 ...tokens,
539 estimate: {
540 ...tokens.estimate,
541 inputs: {
542 resolution: { param: 'resolution', kind: 'enum', values: ['1'] },
543 },
544 },
545 },
546 },
547 }
548 expect(rateCardSchema.safeParse(shadowing).success).toBe(false)
549 })
550})
551​
552describe('unread keys and defaults', () => {
553 // Anthropic-style rates: $3 in, $15 out, $0.30 cache read per 1M.
554 const card = compileTokenCard(
555 {
556 input_tokens: 3 / 1e6,
557 output_tokens: 15 / 1e6,
558 cache_read_tokens: 0.3 / 1e6,
559 },
560 [],
561 source,
562 )
563 if (!card) throw new Error('did not compile')
564​
565 it("refuses Anthropic's native cache_read_input_tokens instead of pricing it at 0", () => {
566 expect(() =>
567 priceDetailed(
568 card,
569 {},
570 {
571 input_tokens: 12_000,
572 output_tokens: 800,
573 cache_read_input_tokens: 4000,
574 },
575 ),
576 ).toThrow(
577 expect.objectContaining({
578 code: 'unknown-usage-key',
579 message:
580 'usage.cache_read_input_tokens: not read by this card; it reads usage.input_tokens, usage.output_tokens, usage.cache_read_tokens',
581 }),
582 )
583 })
584​
585 it("prices the card's own cache_read_tokens with nothing defaulted", () => {
586 const result = priceDetailed(
587 card,
588 {},
589 { input_tokens: 12_000, output_tokens: 800, cache_read_tokens: 4000 },
590 )
591 // 12000 × 3/M + 800 × 15/M + 4000 × 0.3/M
592 expect(result.amount).toBeCloseTo(0.0492, 9)
593 expect(result).toMatchObject({ estimated: [], defaulted: [], ignored: [] })
594 })
595​
596 it('names a usage-bound default it applied', () => {
597 expect(
598 priceDetailed(card, {}, { input_tokens: 12_000, output_tokens: 800 }),
599 ).toMatchObject({ amount: 0.048, defaulted: ['cache_read_tokens'] })
600 })
601​
602 it('lists a request field sent in usage as a request key', () => {
603 expect(() => priceDetailed(cardFor({ var: 'x' }), {}, { x: 3 })).toThrow(
604 /usage\.x: not read by this card; it reads request\.x, request\.y$/,
605 )
606 })
607​
608 it('lists request keys the card does not read as ignored', () => {
609 const result = priceDetailed(cardFor({ '*': [{ var: 'x' }, 2] }), {
610 x: 3,
611 prompt: 'a cat',
612 seed: 7,
613 })
614 expect(result).toMatchObject({
615 amount: 6,
616 defaulted: ['y'],
617 ignored: ['prompt', 'seed'],
618 })
619 })
620​
621 it('leaves price() lenient for flat example bags', () => {
622 expect(
623 price(
624 card,
625 { model: 'm' },
626 { input_tokens: 1, output_tokens: 0, model: 'm' },
627 ),
628 ).toBeCloseTo(3 / 1e6, 12)
629 })
630​
631 it('reads estimate inputs as card params', () => {
632 const estimated = rateCardSchema.parse({
633 ...cardFor({ var: 'tokens' }),
634 inputs: {
635 tokens: {
636 param: 'tokens',
637 bound: 'usage',
638 kind: 'number',
639 estimate: {
640 inputs: { seconds: { param: 'seconds', kind: 'number' } },
641 value: { var: 'seconds' },
642 source,
643 },
644 },
645 },
646 })
647 expect(cardParams(estimated)).toEqual({
648 request: ['seconds'],
649 usage: ['tokens'],
650 })
651 })
652​
653 it('names a default an estimate input took', () => {
654 const estimated = rateCardSchema.parse({
655 ...cardFor({ var: 'tokens' }),
656 inputs: {
657 tokens: {
658 param: 'tokens',
659 bound: 'usage',
660 kind: 'number',
661 estimate: {
662 inputs: {
663 seconds: { param: 'seconds', kind: 'number', default: 0 },
664 },
665 value: { '+': [{ var: 'seconds' }, 1] },
666 source,
667 },
668 },
669 },
670 })
671 expect(priceDetailed(estimated, {}, {})).toMatchObject({
672 amount: 1,
673 estimated: ['tokens'],
674 defaulted: ['seconds'],
675 })
676 expect(priceDetailed(estimated, { seconds: 4 }, {})).toMatchObject({
677 amount: 5,
678 estimated: ['tokens'],
679 defaulted: [],
680 })
681 })
682})