SPB Git forge

spb/rareindex

Public
54commits 1branches 0releases
7.1 MBsize
maindefault branch
10 days agolast push
TypeScript 61.9% HTML 37.2% SQL 0.7%
1.2 KB · 27 lines typescript
Raw Blame History
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