All checks were successful
Deploy production / deploy (push) Successful in 1m18s
- cs.skins catalog (weapons, knives, gloves, stickers, cases, agents, charms, …) refreshed weekly - every market config: wears in float range, StatTrak, Souvenir, Doppler/Gamma phases - cs.daily_prices (one row per config/stream/day, idempotent) from Skinport, Steam, CSFloat, Buff163 - cs.price_windows for 24h/7d/30d/90d sale aggregates, cs.fx_rates (ECB) - scripts/cs-prices.ts daily|catalog|prices; legacy ingest fixed for the new unique index - skin browser + /projects/cs-prices/[slug] with variant/wear/phase switcher and real charts - charts show points for short histories and pad sparse time axes
44 lines
1.6 KiB
TypeScript
44 lines
1.6 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { configRank, parseConfig, slugify } from './catalog';
|
|
|
|
describe('parseConfig', () => {
|
|
it('splits knives, StatTrak and wear', () => {
|
|
expect(parseConfig('★ StatTrak™ Karambit | Doppler (Factory New)')).toEqual({
|
|
starred: true,
|
|
stattrak: true,
|
|
souvenir: false,
|
|
wear: 'Factory New',
|
|
base: 'Karambit | Doppler',
|
|
display: '★ Karambit | Doppler'
|
|
});
|
|
});
|
|
it('handles souvenirs and wearless items', () => {
|
|
expect(parseConfig('Souvenir AWP | Dragon Lore (Field-Tested)').souvenir).toBe(true);
|
|
expect(parseConfig('Souvenir AWP | Dragon Lore (Field-Tested)').base).toBe('AWP | Dragon Lore');
|
|
expect(parseConfig('Sticker | Heroic (Holo) | Rio 2022').base).toBe(
|
|
'Sticker | Heroic (Holo) | Rio 2022'
|
|
);
|
|
expect(parseConfig('Paris 2023 Mirage Souvenir Package').souvenir).toBe(false);
|
|
expect(parseConfig('StatTrak™ Music Kit | Daniel Sadowski, Crimson Assault').base).toBe(
|
|
'Music Kit | Daniel Sadowski, Crimson Assault'
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('slugify', () => {
|
|
it('makes stable slugs', () => {
|
|
expect(slugify('★ Karambit | Doppler')).toBe('karambit-doppler');
|
|
expect(slugify('AK-47 | Redline')).toBe('ak-47-redline');
|
|
});
|
|
});
|
|
|
|
describe('configRank', () => {
|
|
it('sorts normal, then StatTrak, by wear and phase', () => {
|
|
const a = configRank({ stattrak: false, souvenir: false, wear: 'Factory New', phase: 'Ruby' });
|
|
const b = configRank({ stattrak: false, souvenir: false, wear: 'Minimal Wear', phase: null });
|
|
const c = configRank({ stattrak: true, souvenir: false, wear: 'Factory New', phase: null });
|
|
expect(a).toBeLessThan(b);
|
|
expect(b).toBeLessThan(c);
|
|
});
|
|
});
|