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 { listFixtures, loadFixture, runFixtureSuite } from '@rareindex/connectors/testing';5import createConnector from './index.js';67// meta.json is read directly so the suite does not depend on connectors/registry.json being regenerated.8const connector = createConnector(ConnectorMetaSchema.parse(metaJson));910describe('rebag', () => {11 runFixtureSuite(connector, it, expect);1213 it('normalises the first fixture into listing records with the expected fields', async () => {14 const [name] = listFixtures('rebag');15 const fx = loadFixture('rebag', name!);16 const out = await connector.normalize(fx.raw);17 expect(out.length).toBeGreaterThan(0);18 const l = out.find((r) => r.kind === 'listing' && r.attributes.categorySlug === 'luxury_handbags');19 if (l?.kind !== 'listing') throw new Error('no handbag listing');20 expect(l.currency).toBe('USD');21 expect(l.condition.conditionRaw).toBeTruthy();22 expect(l.attributes.identifiers.rebag_item).toBeTruthy();23 });24 it('parses Rebag variant titles and retail price', async () => {25 const { parseVariantTitle, retailFromBody, categoryFor } = await import('./index.js');26 expect(parseVariantTitle('Great | Item # 417505/4 / Blue')).toEqual({ grade: 'Great', color: 'Blue' });27 expect(retailFromBody('<b>Estimated Retail Price:</b> $4,850<br>')).toBe(4850);28 expect(categoryFor('Top Handle Bag', 'Hermes', [])).toBe('luxury_handbags');29 expect(categoryFor('Dress', 'Hermes', [])).toBe('fashion_streetwear');30 });31});32