TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1import { describe, expect, it } from 'vitest';2import metaJson from './meta.json' with { type: 'json' };3import { loadFixture, runFixtureSuite } from '@rareindex/connectors/testing';4import { localMeta } from '../_lib/local-meta.js';5import createConnector, { categoryFor, trimListing } from './index.js';67const connector = createConnector(localMeta(metaJson));89describe('reverb', () => {10 runFixtureSuite(connector, it, expect);1112 it('maps categories and trims API listings', async () => {13 expect(categoryFor(['Home Audio / Amplifiers'])).toBe('audio_equipment');14 expect(categoryFor(['Electric Guitars / Solid Body'])).toBe('musical_instruments');15 const l = trimListing({ id: 1, make: 'Fender', model: 'Stratocaster', year: '1965', title: 'Fender Stratocaster 1965', condition: { display_name: 'Excellent' }, price: { amount: '18184.16', currency: 'USD' }, listing_currency: 'EUR', categories: [{ full_name: 'Electric Guitars / Solid Body' }], state: { slug: 'live' }, _links: { web: { href: 'https://reverb.com/item/1-x' } }, photos: [{ _links: { large_crop: { href: 'https://img/1.jpg' } } }] });16 expect(l).toMatchObject({ id: 1, make: 'Fender', year: '1965', condition: 'Excellent', price: 18184.16, currency: 'USD', listingCurrency: 'EUR', photo: 'https://img/1.jpg' });17 const fx = loadFixture('reverb', 'stratocaster-p1');18 const out = await connector.normalize(fx.raw);19 expect(out.length).toBeGreaterThan(0);20 for (const r of out) {21 if (r.kind !== 'listing') throw new Error('expected listing');22 expect(['musical_instruments', 'audio_equipment']).toContain(r.attributes.categorySlug);23 expect(r.attributes.identifiers.reverb_listing_id).toMatch(/^\d+$/);24 expect(r.price).toBeGreaterThan(0);25 expect(r.currency).toBe('USD');26 expect(r.sourceUrl).toMatch(/reverb\.com/);27 }28 });29});30