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.8 KB · 36 lines typescript
Raw Blame History
1import { describe, expect, it } from 'vitest';2import { getConnectorMeta } from '@rareindex/connectors';3import { loadFixture, runFixtureSuite } from '@rareindex/connectors/testing';4import createConnector from './index.js';56const connector = createConnector(getConnectorMeta('sportscardspro'));78describe('sportscardspro', () => {9  runFixtureSuite(connector, it, expect);1011  it('maps a 1986 Fleer Jordan page to a sports card asset with graded and raw sales', async () => {12    const fx = loadFixture('sportscardspro', 'basketball-1986-fleer__michael-jordan-57');13    const out = await connector.normalize(fx.raw);14    const cat = out.find((r) => r.kind === 'catalog_item');15    if (cat?.kind !== 'catalog_item') throw new Error('no catalog item');16    expect(cat.attributes.categorySlug).toBe('basketball_cards');17    expect(cat.attributes.set).toBe('1986 Fleer');18    expect(cat.attributes.year).toBe(1986);19    expect(cat.attributes.number).toBe('57');20    expect(cat.attributes.name).toBe('Michael Jordan');21    expect(cat.attributes.brand).toBe('Fleer');22    expect(cat.attributes.variant).toBeNull(); // "[Rookie]" is a status tag, not a printing23    expect(cat.attributes.metadata.rookie).toBe(true);24    expect(cat.attributes.identifiers.pricecharting_id).toMatch(/^scp:\d+$/);25    const guides = out.filter((r) => r.kind === 'price_observation');26    expect(guides.length).toBeGreaterThanOrEqual(10);27    const psa10 = guides.find((g) => g.kind === 'price_observation' && g.grade.grader === 'psa' && g.grade.grade === '10');28    expect(psa10).toBeTruthy();29    const sales = out.filter((r) => r.kind === 'sale');30    expect(sales.length).toBeGreaterThan(10);31    const graded = sales.filter((s) => s.kind === 'sale' && s.grade.grade !== null);32    expect(graded.length).toBeGreaterThan(0);33    for (const s of sales) if (s.kind === 'sale') expect(s.currency).toBe('USD');34  });35});36