TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1import { describe, expect, it } from 'vitest';2import { ConnectorMetaSchema } from '@rareindex/connectors';3import { loadFixture, runFixtureSuite } from '@rareindex/connectors/testing';4import metaJson from './meta.json' with { type: 'json' };5import createConnector, { auctionSaleDate, discoverRealizedSlugs, imageUrl, parseAuctionPageData } from './index.js';67const connector = createConnector(ConnectorMetaSchema.parse(metaJson));89describe('gooding', () => {10 runFixtureSuite(connector, it, expect);1112 it('maps realized lots to auction sales in the auction currency', async () => {13 const fx = loadFixture('gooding', 'realized-auction');14 const out = await connector.normalize(fx.raw);15 expect(out.length).toBeGreaterThan(0);16 for (const r of out) {17 if (r.kind !== 'sale') throw new Error('expected sale');18 expect(['USD', 'GBP', 'EUR']).toContain(r.currency);19 expect(r.saleType).toBe('auction');20 expect(r.buyerPremiumIncluded).toBeNull();21 expect(['automobiles', 'motorcycles', 'automotive_memorabilia']).toContain(r.attributes.categorySlug);22 expect(r.attributes.identifiers.gooding_lot).toBeTruthy();23 expect(r.sourceUrl).toMatch(/^https:\/\/www\.goodingco\.com\/lot\//);24 expect(r.auctionHouse).toBe('Gooding & Company');25 }26 });2728 it('parses page-data JSON, dates and images', () => {29 const json = { result: { data: { contentfulWebPageAuction: { title: 'x', auction: { name: 'Pebble Beach Auctions', currency: 'USD', sellThroughRate: 0.94, subEvents: [{ __typename: 'ContentfulSubEventViewing' }, { __typename: 'ContentfulSubEventAuction', startDate: '2026-08-14T16:00-08:00', endDate: '2026-08-14T21:00-08:00' }, { __typename: 'ContentfulSubEventAuction', startDate: '2026-08-15T11:00-08:00', endDate: '2026-08-15T16:00-08:00' }], lot: [{ slug: '1961-jaguar-xk150', lotNumber: 116, salePrice: 72800, privateSalesPrice: false, item: { __typename: 'ContentfulVehicle', title: '1961 Jaguar XK150 3.8-Litre Fixed Head Coupe', modelYear: 1961, make: { name: 'Jaguar' }, model: 'XK150', cloudinaryImagesCombined: [{ public_id: 'Prod/PB26 Pebble/1961_Jaguar' }] } }, { slug: 'unsold', lotNumber: 1, salePrice: null, item: { title: 'Unsold car' } }] } } } } };30 const p = parseAuctionPageData(json, 'pebble-beach-auctions-2026')!;31 expect(p.saleDate).toBe('2026-08-15T00:00:00.000Z');32 expect(p.lots).toHaveLength(2);33 expect(p.lots[0]!.image).toBe('https://res.cloudinary.com/goodingco/image/upload/c_fill,w_1200/Prod/PB26%20Pebble/1961_Jaguar');34 expect(auctionSaleDate(undefined)).toBeNull();35 expect(imageUrl(null)).toBeNull();36 expect(discoverRealizedSlugs('<a href="/auction/realized/pebble-beach-auctions-2026">x</a><a href="https://www.goodingco.com/auction/realized/amelia-island-auctions-2026/">y</a>')).toEqual(['pebble-beach-auctions-2026', 'amelia-island-auctions-2026']);37 });38});39