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('bobs-watches', () => {11 runFixtureSuite(connector, it, expect);1213 it('normalises the first fixture into listing records with the expected fields', async () => {14 const [name] = listFixtures('bobs-watches');15 const fx = loadFixture('bobs-watches', 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.brand).toBe('Rolex');22 expect(l.attributes.reference).toMatch(/^\d{4,6}/);23 expect(l.attributes.identifiers.reference).toBe(l.attributes.reference);24 expect(l.currency).toBe('USD');25 expect(l.sourceUrl).toMatch(/bobswatches\.com\/.+\.html$/);26 });2728});29