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('flight-club', () => { runFixtureSuite(connector, it, expect); it('normalises the first fixture into catalog_item records with the expected fields', async () => { const [name] = listFixtures('flight-club'); const fx = loadFixture('flight-club', name!); const out = await connector.normalize(fx.raw); expect(out.length).toBeGreaterThan(0); const cat = out.find((r) => r.kind === 'catalog_item'); if (cat?.kind !== 'catalog_item') throw new Error('no catalog item'); expect(cat.attributes.identifiers.style_code).toBeTruthy(); expect(cat.attributes.identifiers.flightclub_id).toMatch(/^\d+$/); const ask = out.find((r) => r.kind === 'listing'); if (ask?.kind === 'listing') { expect(ask.currency).toBe('USD'); expect(ask.listingType).toBe('ask'); } }); });