SPB Git

spb/rareindex

Public
1.3 KB · 27 lines typescript
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('flight-club', () => {11  runFixtureSuite(connector, it, expect);1213  it('normalises the first fixture into catalog_item records with the expected fields', async () => {14    const [name] = listFixtures('flight-club');15    const fx = loadFixture('flight-club', name!);16    const out = await connector.normalize(fx.raw);17    expect(out.length).toBeGreaterThan(0);18    const cat = out.find((r) => r.kind === 'catalog_item');19    if (cat?.kind !== 'catalog_item') throw new Error('no catalog item');20    expect(cat.attributes.identifiers.style_code).toBeTruthy();21    expect(cat.attributes.identifiers.flightclub_id).toMatch(/^\d+$/);22    const ask = out.find((r) => r.kind === 'listing');23    if (ask?.kind === 'listing') { expect(ask.currency).toBe('USD'); expect(ask.listingType).toBe('ask'); }24  });2526});27
Files · b5d6968a47f5d2546937866bdabc967739349047
Menu

Theme