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.0 KB · 23 lines typescript
Raw Blame History
1import { describe, expect, it } from 'vitest';2import { endingHours, houseSlug, resolveHouse } from './auction-house';34describe('auction house slugs', () => {5  it('slugifies house names deterministically and drops apostrophes', () => {6    expect(houseSlug("Sotheby's")).toBe('sothebys');7    expect(houseSlug('Hake’s Auctions')).toBe('hakes-auctions');8    expect(houseSlug('Yahoo! Auctions Japan (ヤフオク!)')).toMatch(/^yahoo-auctions-japan/);9    expect(houseSlug('   ')).toBe('house');10  });11  it('resolves a slug back to the registry entry', () => {12    const houses = [{ house: "Sotheby's", lots: 1 }, { house: 'Bonhams', lots: 2 }];13    expect(resolveHouse('sothebys', houses)?.house).toBe("Sotheby's");14    expect(resolveHouse('BONHAMS', houses)?.lots).toBe(2);15    expect(resolveHouse('christies', houses)).toBeNull();16  });17  it('maps ending-window ids to hours', () => {18    expect(endingHours('24h')).toBe(24);19    expect(endingHours('7d')).toBe(168);20    expect(endingHours('nope')).toBeNull();21  });22});23