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.4 KB · 30 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, { splitName, PLATFORMS } from './index.js';67const connector = createConnector(localMeta(metaJson));89describe('lukie-games', () => {10  runFixtureSuite(connector, it, expect);1112  it('maps platforms and strips platform tokens from names', async () => {13    expect(splitName('Zelda Ocarina of Time N64 Game Complete', 'Nintendo 64')).toMatchObject({ name: 'Zelda Ocarina of Time', completeness: 'cib' });14    expect(splitName('GoldenEye 007', 'Nintendo 64')).toMatchObject({ name: 'GoldenEye 007', completeness: null });15    expect(PLATFORMS['Nintendo 64']).toEqual({ set: 'Nintendo 64', slug: 'nintendo_games' });16    const fx = loadFixture('lukie-games', 'nintendo-64-p1');17    const out = await connector.normalize(fx.raw);18    expect(out.length).toBeGreaterThan(0);19    for (const r of out) {20      if (r.kind !== 'listing') throw new Error('expected listing');21      expect(r.attributes.categorySlug).toBe('nintendo_games');22      expect(r.attributes.set).toBe('Nintendo 64');23      expect(r.attributes.name).not.toMatch(/^Manual/);24      expect(r.attributes.identifiers.lukie_sku).toBeTruthy();25      expect(r.condition.completeness).toBeTruthy();26      expect(r.currency).toBe('USD');27    }28  });29});30