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('crown-caliber', () => {11 runFixtureSuite(connector, it, expect);1213 it('normalises the first fixture into listing records with the expected fields', async () => {14 const [name] = listFixtures('crown-caliber');15 const fx = loadFixture('crown-caliber', name!);16 const out = await connector.normalize(fx.raw);17 expect(out.length).toBeGreaterThan(0);18 const l = out[0];19 if (l?.kind !== 'listing') throw new Error('no listing');20 expect(l.attributes.categorySlug).toBe('rolex');21 expect(l.attributes.reference).toBeTruthy();22 expect(l.currency).toBe('USD');23 expect(l.sourceUrl).toMatch(/europeanwatch\.com\/watch\//);24 });25 it('splits names into reference + model and reads circa years', async () => {26 const { splitName } = await import('./index.js');27 expect(splitName('Rolex 16710 GMT-Master II Coke Bezel SS Black Dial Circa. 2000', 'Rolex')).toEqual({ reference: '16710', model: 'GMT-Master II Coke Bezel' });28 expect(splitName('Patek Philippe 5711/1A-010 Nautilus SS Blue Dial', 'Patek Philippe')).toMatchObject({ reference: '5711/1A-010' });29 });30});31