SPB Git forge

spb/rareindex

Public
54commits 1branches 0releases
7.1 MBsize
maindefault branch
10 days agolast push
TypeScript 61.9% HTML 37.2% SQL 0.7%
1.2 KB · 28 lines typescript
Raw Blame History
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('subdial', () => {11  runFixtureSuite(connector, it, expect);1213  it('normalises the first fixture into listing records with the expected fields', async () => {14    const [name] = listFixtures('subdial');15    const fx = loadFixture('subdial', 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.currency).toBe('GBP');21    expect(l.attributes.reference).toBeTruthy();22    expect(l.attributes.identifiers.subdial_id).toMatch(/^SD\d+/);23    if (l.attributes.model) expect(l.attributes.model).not.toMatch(/box|papers|\b(19|20)\d{2}\b/i);24    expect(l.seller).toBe('Subdial');25  });2627});28