TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1import { describe, expect, it } from 'vitest';2import { ConnectorMetaSchema } from '@rareindex/connectors';3import metaJson from './meta.json' with { type: 'json' };4import { listFixtures, loadFixture, runFixtureSuite } from '@rareindex/connectors/testing';5import createConnector from './index.js';67// meta.json is read directly so the suite does not depend on connectors/registry.json being regenerated.8const connector = createConnector(ConnectorMetaSchema.parse(metaJson));910describe('antiquorum', () => {11 runFixtureSuite(connector, it, expect);1213 it('normalises the first fixture into sale records with the expected fields', async () => {14 const [name] = listFixtures('antiquorum');15 const fx = loadFixture('antiquorum', name!);16 const out = await connector.normalize(fx.raw);17 expect(out.length).toBeGreaterThan(0);18 const sale = out.find((r) => r.kind === 'sale');19 if (sale?.kind !== 'sale') throw new Error('no sale');20 expect(sale.saleType).toBe('auction');21 expect(sale.buyerPremiumIncluded).toBe(true);22 expect(['CHF', 'HKD', 'EUR', 'USD']).toContain(sale.currency);23 expect(sale.auctionHouse).toBe('Antiquorum');24 expect(sale.lotNumber).toMatch(/^\d+/);25 expect(sale.attributes.brand).not.toMatch(/switzerland/i);26 expect(sale.saleDate.getUTCFullYear()).toBeGreaterThanOrEqual(2022);27 const lot = out.find((r) => r.kind === 'auction_lot');28 if (lot && lot.kind === 'auction_lot') expect(lot.auctionHouse).toBe('Antiquorum');29 });30 it('parses the catalogue home into auctions with ids and dates', async () => {31 const { parseAuctionIndex } = await import('./index.js');32 const html = '<div><h3>Important Modern & Vintage Timepieces</h3><p>Hong Kong May 31, 2026</p><a href="/en/auctions/Hong_Kong_May_31_2026/lots">Lots</a> <a href="/en/auctions/387/price-list">Price list</a></div><div><h3>Only Online Auction</h3><p>Sep 18, 2025</p><a href="/en/auctions/hong_kong_september_18_2025/lots">Lots</a><a href="/en/auctions/378/price-list">x</a></div>';33 const a = parseAuctionIndex(html);34 expect(a[0]).toMatchObject({ slug: 'Hong_Kong_May_31_2026', id: '387', date: 'May 31, 2026', location: 'Hong Kong' });35 expect(a[1]).toMatchObject({ slug: 'hong_kong_september_18_2025', id: '378' });36 });37});38