import { describe, expect, it } from 'vitest'; import { hintFromLabel, isBundleTitle, slugFromTitle, watchBrand, watchReference } from './categories.js'; describe('auction category mapping', () => { it('watch departments', () => { expect(slugFromTitle('ROLEX. A STAINLESS STEEL WRISTWATCH REF. 16610 SUBMARINER', 'watches')).toBe('rolex'); expect(slugFromTitle('Patek Philippe Nautilus 5711/1A-010', 'watches')).toBe('patek_philippe'); expect(slugFromTitle('Audemars Piguet Royal Oak 15202ST', 'watches')).toBe('audemars_piguet'); expect(slugFromTitle('Omega Speedmaster Professional 145.022', 'watches')).toBe('omega'); expect(slugFromTitle('Hermès Birkin 35 Togo', 'watches')).toBe('luxury_handbags'); expect(slugFromTitle('A diamond and platinum ring, 2.01 carats', 'watches')).toBe('jewelry'); expect(slugFromTitle('Montblanc Meisterstück fountain pen 149', 'watches')).toBe('pens'); expect(watchBrand('CARTIER TANK LOUIS').brand).toBe('Cartier'); expect(watchReference('Ref. 5711/1A-010')).toBe('5711/1A-010'); }); it('labels → hints', () => { expect(hintFromLabel('Wines & Spirits')).toBe('wine'); expect(hintFromLabel('Coins, Medals and Banknotes')).toBe('coins'); expect(hintFromLabel('Designer Handbags & Fashion')).toBe('handbags'); expect(hintFromLabel('Popular Culture')).toBe('popular_culture'); expect(hintFromLabel('Science and Natural History')).toBe('natural_history'); expect(hintFromLabel('Sneakers, Streetwear & Modern Collectables')).toBe('fashion'); expect(hintFromLabel('Random Department')).toBe('unknown'); }); it('keyword sweeps and honesty', () => { expect(slugFromTitle('LEGO 10179 Millennium Falcon UCS sealed', 'toys')).toBe('lego_sets'); expect(slugFromTitle('Funko Pop! Marvel #01', 'toys')).toBe('funko'); expect(slugFromTitle('Nike Air Jordan 1 Chicago 1985', 'fashion')).toBe('sneakers'); expect(slugFromTitle('1999 Pokémon Base Set Charizard PSA 10', 'popular_culture')).toBe('pokemon'); expect(slugFromTitle('Amazing Spider-Man #300 CGC 9.8', 'popular_culture')).toBe('marvel_comics'); expect(slugFromTitle('Apollo 11 flown mission patch', 'popular_culture')).toBe('space'); expect(slugFromTitle('Untitled abstract composition', 'unknown')).toBeNull(); expect(isBundleTitle('A collection of 45 coins')).toBe(true); expect(isBundleTitle('1 sovereign 1912')).toBe(false); }); });