18 lines
650 B
JavaScript
18 lines
650 B
JavaScript
|
|
import { describe, expect, it } from 'vitest';
|
||
|
|
|
||
|
|
import { effectiveUnitPriceExpr, listUnitPriceExpr } from '../../../lib/pricing/collection-valuation.js';
|
||
|
|
|
||
|
|
describe('collection-valuation', () => {
|
||
|
|
it('builds foil-aware unit price SQL', () => {
|
||
|
|
expect(effectiveUnitPriceExpr()).toContain('uc.is_foil');
|
||
|
|
expect(effectiveUnitPriceExpr()).toContain('c.current_price');
|
||
|
|
expect(effectiveUnitPriceExpr({ cardAlias: 'cards', userCardAlias: 'user_cards' })).toContain(
|
||
|
|
'user_cards.is_foil'
|
||
|
|
);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('builds list unit price SQL', () => {
|
||
|
|
expect(listUnitPriceExpr()).toBe('COALESCE(c.current_price, c.market_price)');
|
||
|
|
});
|
||
|
|
});
|