import { describe, expect, it } from 'vitest'; import { ConnectorMetaSchema } from '@rareindex/connectors'; import metaJson from './meta.json' with { type: 'json' }; import { listFixtures, loadFixture, runFixtureSuite } from '@rareindex/connectors/testing'; import createConnector from './index.js'; // meta.json is read directly so the suite does not depend on connectors/registry.json being regenerated. const connector = createConnector(ConnectorMetaSchema.parse(metaJson)); describe('antiquorum', () => { runFixtureSuite(connector, it, expect); it('normalises the first fixture into sale records with the expected fields', async () => { const [name] = listFixtures('antiquorum'); const fx = loadFixture('antiquorum', name!); const out = await connector.normalize(fx.raw); expect(out.length).toBeGreaterThan(0); const sale = out.find((r) => r.kind === 'sale'); if (sale?.kind !== 'sale') throw new Error('no sale'); expect(sale.saleType).toBe('auction'); expect(sale.buyerPremiumIncluded).toBe(true); expect(['CHF', 'HKD', 'EUR', 'USD']).toContain(sale.currency); expect(sale.auctionHouse).toBe('Antiquorum'); expect(sale.lotNumber).toMatch(/^\d+/); expect(sale.attributes.brand).not.toMatch(/switzerland/i); expect(sale.saleDate.getUTCFullYear()).toBeGreaterThanOrEqual(2022); const lot = out.find((r) => r.kind === 'auction_lot'); if (lot && lot.kind === 'auction_lot') expect(lot.auctionHouse).toBe('Antiquorum'); }); it('parses the catalogue home into auctions with ids and dates', async () => { const { parseAuctionIndex } = await import('./index.js'); const html = '
'; const a = parseAuctionIndex(html); expect(a[0]).toMatchObject({ slug: 'Hong_Kong_May_31_2026', id: '387', date: 'May 31, 2026', location: 'Hong Kong' }); expect(a[1]).toMatchObject({ slug: 'hong_kong_september_18_2025', id: '378' }); }); });