import { describe, expect, it } from 'vitest'; import metaJson from './meta.json' with { type: 'json' }; import { loadFixture, runFixtureSuite } from '@rareindex/connectors/testing'; import { localMeta } from '../../api/_lib/local-meta.js'; import createConnector, { parseErocksDate } from './index.js'; const connector = createConnector(localMeta(metaJson)); describe('e-rocks', () => { runFixtureSuite(connector, it, expect); it('parses BST end times and emits live mineral lots in EUR', async () => { expect(parseErocksDate('07/09/2026 22:10 BST')).toBe('2026-09-07T21:10:00.000Z'); const fx = loadFixture('e-rocks', 'auction-p1'); const out = await connector.normalize(fx.raw); expect(out.length).toBeGreaterThan(0); for (const r of out) { if (r.kind !== 'auction_lot') throw new Error('expected auction_lot'); expect(r.attributes.categorySlug).toBe('minerals'); expect(r.attributes.identifiers.erocks_item).toMatch(/^[A-Z0-9]+$/); expect(r.auctionHouse).toBe('e-Rocks'); expect(r.currency).toBe('EUR'); expect(['live', 'ended']).toContain(r.status); } expect(out.every((r) => r.kind === 'auction_lot' && r.endsAt instanceof Date)).toBe(true); expect(out.some((r) => r.kind === 'auction_lot' && r.location)).toBe(true); }); });