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, { jpy } from './index.js';67const connector = createConnector(ConnectorMetaSchema.parse(metaJson));89describe('hobbysearch', () => {10 runFixtureSuite(connector, it, expect);1112 it('emits catalog items with MSRP and JPY retailer listings', async () => {13 const fx = loadFixture('hobbysearch', 'gundam-mg-search-p1');14 const out = await connector.normalize(fx.raw);15 const cats = out.filter((r) => r.kind === 'catalog_item');16 const lst = out.filter((r) => r.kind === 'listing');17 expect(cats.length).toBeGreaterThan(0);18 expect(lst.length).toBeGreaterThan(0);19 for (const c of cats) {20 if (c.kind !== 'catalog_item') continue;21 expect(['gundam', 'action_figures']).toContain(c.attributes.categorySlug);22 expect(c.attributes.identifiers.hobbysearch_id).toMatch(/^\d+$/);23 expect(c.sourceUrl).toMatch(/1999\.co\.jp\/eng\/\d+$/);24 }25 for (const l of lst) {26 if (l.kind !== 'listing') continue;27 expect(l.currency).toBe('JPY');28 expect(l.price).toBeGreaterThan(0);29 expect(l.seller).toBe('HobbySearch');30 }31 });3233 it('parses JPY strings', () => {34 expect(jpy('7,200 JPY')).toBe(7200);35 expect(jpy('110')).toBe(110);36 expect(jpy(null)).toBeNull();37 });38});39