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('subdial', () => { runFixtureSuite(connector, it, expect); it('normalises the first fixture into listing records with the expected fields', async () => { const [name] = listFixtures('subdial'); const fx = loadFixture('subdial', name!); const out = await connector.normalize(fx.raw); expect(out.length).toBeGreaterThan(0); const l = out[0]; if (l?.kind !== 'listing') throw new Error('no listing'); expect(l.currency).toBe('GBP'); expect(l.attributes.reference).toBeTruthy(); expect(l.attributes.identifiers.subdial_id).toMatch(/^SD\d+/); if (l.attributes.model) expect(l.attributes.model).not.toMatch(/box|papers|\b(19|20)\d{2}\b/i); expect(l.seller).toBe('Subdial'); }); });