import { describe, expect, it } from 'vitest'; import metaJson from './meta.json' with { type: 'json' }; import { loadFixture, runFixtureSuite } from '@rareindex/connectors/testing'; import { localMeta } from '../_lib/local-meta.js'; import createConnector, { splitName, PLATFORMS } from './index.js'; const connector = createConnector(localMeta(metaJson)); describe('lukie-games', () => { runFixtureSuite(connector, it, expect); it('maps platforms and strips platform tokens from names', async () => { expect(splitName('Zelda Ocarina of Time N64 Game Complete', 'Nintendo 64')).toMatchObject({ name: 'Zelda Ocarina of Time', completeness: 'cib' }); expect(splitName('GoldenEye 007', 'Nintendo 64')).toMatchObject({ name: 'GoldenEye 007', completeness: null }); expect(PLATFORMS['Nintendo 64']).toEqual({ set: 'Nintendo 64', slug: 'nintendo_games' }); const fx = loadFixture('lukie-games', 'nintendo-64-p1'); const out = await connector.normalize(fx.raw); expect(out.length).toBeGreaterThan(0); for (const r of out) { if (r.kind !== 'listing') throw new Error('expected listing'); expect(r.attributes.categorySlug).toBe('nintendo_games'); expect(r.attributes.set).toBe('Nintendo 64'); expect(r.attributes.name).not.toMatch(/^Manual/); expect(r.attributes.identifiers.lukie_sku).toBeTruthy(); expect(r.condition.completeness).toBeTruthy(); expect(r.currency).toBe('USD'); } }); });