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('watchfinder', () => {11 runFixtureSuite(connector, it, expect);1213 it('normalises the first fixture into listing records with the expected fields', async () => {14 const [name] = listFixtures('watchfinder');15 const fx = loadFixture('watchfinder', 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).toMatch(/^\d{5,6}/);22 expect(l.currency).toBe('GBP');23 expect(l.attributes.identifiers.watchfinder_sku).toMatch(/^\d+$/);24 const withYear = out.filter((r) => r.kind === 'listing' && r.attributes.year);25 expect(withYear.length).toBeGreaterThan(out.length / 2);26 const withSet = out.filter((r) => r.kind === 'listing' && r.condition.completeness);27 expect(withSet.length).toBeGreaterThan(0);28 });2930});31