TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1import { describe, expect, it } from 'vitest';2import { readFileSync } from 'node:fs';3import path from 'node:path';4import { fileURLToPath } from 'node:url';5import { loadFixture, runFixtureSuite } from '@rareindex/connectors/testing';6import { localMeta } from '../_lib/local-meta.js';7import { parseSessionPage } from '../wright/index.js';8import { asInertiaHtml, SESSION_JSON } from '../wright/test-data.js';9import createConnector, { LAMA } from './index.js';1011const dir = path.dirname(fileURLToPath(import.meta.url));12const meta = localMeta(JSON.parse(readFileSync(path.join(dir, 'meta.json'), 'utf8')));13const connector = createConnector(meta);1415describe('lama', () => {16 runFixtureSuite(connector, it, expect);1718 it('uses the shared Rago/Wright parser with its own site and house', async () => {19 const p = parseSessionPage(asInertiaHtml(SESSION_JSON), LAMA, 'https://www.lamodern.com/auctions/2026/08/design')!;20 expect(p.site).toBe('https://www.lamodern.com');21 expect(p.house).toBe('Los Angeles Modern Auctions');22 const out = await connector.normalize({ url: 'x', externalId: 'e', kind: 'sale', engine: 'api', fetchedAt: new Date('2026-09-08T00:00:00Z'), payload: p });23 expect(out.length).toBe(2);24 const s = out.find((r) => 'externalId' in r && r.externalId === '413032')!;25 if (s.kind !== 'sale') throw new Error('expected sale');26 expect(s).toMatchObject({ connectorId: 'lama', auctionHouse: 'Los Angeles Modern Auctions', currency: 'USD', price: 57600, buyerPremiumIncluded: null });27 expect(s.sourceUrl).toBe('https://www.lamodern.com/auctions/2026/08/design/100');28 expect(s.attributes.identifiers).toEqual({ lama_item_id: '413032' });29 });3031 it('live fixture sales are USD, dated in the past and mapped to art/design slugs', async () => {32 let sales = 0;33 for (const name of ['session-1', 'session-2']) {34 const out = await connector.normalize(loadFixture('lama', name).raw);35 for (const r of out) {36 if (r.kind !== 'sale') continue;37 sales++;38 expect(r.currency).toBe('USD');39 expect(r.saleDate.getTime()).toBeLessThan(Date.now());40 expect(['contemporary_art', 'art', 'design_furniture', 'photography', 'movie_posters', 'jewelry', 'antiques', 'glass_crystal', 'porcelain', 'silver', 'clocks', 'books', 'other_watches']).toContain(r.attributes.categorySlug);41 }42 }43 expect(sales).toBeGreaterThan(0);44 });45});46