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 · 26 lines typescript
Raw Blame History
1import { describe, expect, it } from 'vitest';2import metaJson from './meta.json' with { type: 'json' };3import { loadFixture, runFixtureSuite } from '@rareindex/connectors/testing';4import { localMeta } from '../_lib/local-meta.js';5import createConnector, { specs } from './index.js';67const connector = createConnector(localMeta(metaJson));89describe('analog-shift', () => {10  runFixtureSuite(connector, it, expect);1112  it('parses spec lines and emits watch listings with references', async () => {13    expect(specs('Reference: 1675 Year: 1968 Case Size: 40mm Condition: Excellent')).toMatchObject({ reference: '1675', year: '1968', 'case size': '40mm', condition: 'Excellent' });14    const fx = loadFixture('analog-shift', 'products-p1');15    const out = await connector.normalize(fx.raw);16    expect(out.length).toBeGreaterThan(0);17    for (const r of out) {18      if (r.kind !== 'listing') throw new Error('expected listing');19      expect(['rolex', 'patek_philippe', 'audemars_piguet', 'omega', 'other_watches']).toContain(r.attributes.categorySlug);20      expect(r.attributes.identifiers.analogshift_sku).toBeTruthy();21      expect(r.seller).toBe('Analog:Shift');22      if (r.price !== null) expect(r.currency).toBe('USD');23    }24  });25});26