SPB Git

spb/rareindex

Public
1.2 KB · 27 lines typescript
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('hypeboost', () => {11  runFixtureSuite(connector, it, expect);1213  it('normalises the first fixture into catalog_item records with the expected fields', async () => {14    const [name] = listFixtures('hypeboost');15    const fx = loadFixture('hypeboost', name!);16    const out = await connector.normalize(fx.raw);17    expect(out.length).toBeGreaterThan(0);18    const ask = out.find((r) => r.kind === 'listing');19    if (ask?.kind !== 'listing') throw new Error('no listing');20    expect(ask.currency).toBe('EUR');21    expect(ask.price).toBeGreaterThan(20);22    expect(ask.attributes.identifiers.hypeboost_id).toMatch(/^\d+$/);23    expect(ask.sourceUrl).toMatch(/hypeboost\.com\/en\/product\//);24  });2526});27
Files · e0d6c47e5aa347b26dd853d903e96b01e1bb2a96
Menu

Theme