TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1import { describe, expect, it } from 'vitest';2import { ConnectorMetaSchema } from '@rareindex/connectors';3import metaJson from './meta.json' with { type: 'json' };4import { loadFixture, runFixtureSuite } from '@rareindex/connectors/testing';5import createConnector, { parseJpCardTitle, yen } from './index.js';67const connector = createConnector(ConnectorMetaSchema.parse(metaJson));89describe('surugaya', () => {10 runFixtureSuite(connector, it, expect);1112 it('emits JPY listings with PSA grades parsed from Japanese titles', async () => {13 const fx = loadFixture('surugaya', 'pokemon-psa-search-p1');14 const out = await connector.normalize(fx.raw);15 const listings = out.filter((r) => r.kind === 'listing');16 expect(listings.length).toBeGreaterThan(0);17 const graded = out.find((r) => r.kind === 'catalog_item' && r.grade.grader === 'psa');18 expect(graded).toBeTruthy();19 if (graded?.kind !== 'catalog_item') throw new Error();20 expect(graded.attributes.categorySlug).toBe('pokemon');21 expect(graded.attributes.number).toMatch(/^\d{3}\/\d{3}$/);22 expect(graded.attributes.language).toBe('Japanese');23 expect(graded.attributes.identifiers.surugaya_id).toBeTruthy();24 for (const l of listings) {25 if (l.kind !== 'listing') continue;26 expect(l.currency).toBe('JPY');27 expect(l.sourceUrl).toMatch(/suruga-ya\.jp\/product\//);28 }29 });3031 it('helpers', () => {32 expect(yen('中古:¥12,800')).toBe(12800);33 expect(yen('品切れ')).toBeNull();34 expect(parseJpCardTitle('114/083[SAR]:【PSA/GEM MT 10】(キラ)メガゲッコウガex')).toEqual({ number: '114/083', rarity: 'SAR', name: 'メガゲッコウガex', grader: 'psa', grade: '10' });35 expect(parseJpCardTitle('096/071[SAR]:【PSA/MINT 9】(キラ)ナンジャモ').grade).toBe('9');36 expect(parseJpCardTitle('ポケモンカードゲーム デッキシールド').grader).toBeNull();37 });38});39