TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1import { describe, expect, it } from 'vitest';2import { readFileSync } from 'node:fs';3import path from 'node:path';4import { fileURLToPath } from 'node:url';5import { loadFixture, runFixtureSuite } from '@rareindex/connectors/testing';6import { localMeta } from '../_lib/local-meta.js';7import createConnector from './index.js';89const dir = path.dirname(fileURLToPath(import.meta.url));10const connector = createConnector(localMeta(JSON.parse(readFileSync(path.join(dir, 'meta.json'), 'utf8'))));1112describe('stanley-gibbons-shop', () => {13 runFixtureSuite(connector, it, expect);1415 it('maps Shopify stamp products to GBP fixed-price listings with SKU identifiers', async () => {16 const fx = loadFixture('stanley-gibbons-shop', 'gb-products-p1');17 const out = await connector.normalize(fx.raw);18 expect(out.length).toBe(1);19 const l = out[0]!;20 if (l.kind !== 'listing') throw new Error('listing');21 expect(l).toMatchObject({ listingType: 'fixed_price', currency: 'GBP', price: 495, seller: 'Stanley Gibbons', availability: 'available', location: 'GB' });22 expect(l.attributes.categorySlug).toBe('stamps');23 expect(l.attributes.identifiers.sku).toBe('P267000807');24 expect(l.sourceUrl).toMatch(/^https:\/\/shop\.stanleygibbons\.com\/products\//);25 });2627 it('skips excluded publications', async () => {28 const fx = loadFixture('stanley-gibbons-shop', 'gb-products-p1');29 const raw = { ...fx.raw, payload: { ...(fx.raw.payload as object), product: { ...(fx.raw.payload as { product: Record<string, unknown> }).product, title: 'Gibbons Stamp Monthly September 2026', product_type: 'Magazine' } } };30 expect(await connector.normalize(raw)).toEqual([]);31 });32});33