import { describe, expect, it } from 'vitest'; import meta from './meta.json' with { type: 'json' }; import { localMeta } from '../_lib/local-meta.js'; import { listFixtures, loadFixture, runFixtureSuite } from '@rareindex/connectors/testing'; import createConnector from './index.js'; const connector = createConnector(localMeta(meta)); describe('grand-archive', () => { runFixtureSuite(connector, it, expect); it('emits one catalog item per edition/finish with publisher populations', async () => { const [name] = listFixtures('grand-archive'); const out = await connector.normalize(loadFixture('grand-archive', name!).raw); expect(out.length).toBeGreaterThanOrEqual(1); for (const c of out) { if (c.kind !== 'catalog_item') throw new Error('expected catalog item'); expect(c.attributes.categorySlug).toBe('other_tcg'); expect(c.attributes.franchise).toBe('Grand Archive'); expect(c.attributes.identifiers.gatcg_edition_id).toBeTruthy(); // production quantity only when the publisher states an exact count if (c.attributes.productionQuantity !== null) expect(c.attributes.metadata.population_exact).toBe(true); } }); });