All checks were successful
Test and deploy staging / staging (push) Successful in 11m52s
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { dimensionsFromName } from './taxonomy';
|
|
|
|
describe('CS market dimensions', () => {
|
|
it('groups normal and StatTrak wear variants under the same gun and skin', () => {
|
|
const normal = dimensionsFromName('AK-47 | Redline (Field-Tested)');
|
|
const stattrak = dimensionsFromName('StatTrak™ AK-47 | Redline (Minimal Wear)');
|
|
expect(normal).toMatchObject({
|
|
category: 'weapon',
|
|
weapon_type: 'rifle',
|
|
weapon: 'AK-47',
|
|
skin: 'Redline',
|
|
weapon_skin: 'AK-47 | Redline',
|
|
wear: 'Field-Tested',
|
|
stattrak: 'no'
|
|
});
|
|
expect(stattrak).toMatchObject({
|
|
category: 'weapon',
|
|
weapon_type: 'rifle',
|
|
weapon: 'AK-47',
|
|
skin: 'Redline',
|
|
wear: 'Minimal Wear',
|
|
stattrak: 'yes'
|
|
});
|
|
});
|
|
|
|
it('recognizes knives, gloves, souvenir weapons, and non-weapon entries', () => {
|
|
expect(dimensionsFromName('★ Karambit | Doppler (Factory New)')).toMatchObject({
|
|
category: 'knife',
|
|
weapon: 'Karambit',
|
|
skin: 'Doppler'
|
|
});
|
|
expect(dimensionsFromName('★ Sport Gloves | Vice (Field-Tested)')).toMatchObject({
|
|
category: 'gloves',
|
|
weapon: 'Sport Gloves'
|
|
});
|
|
expect(dimensionsFromName('Souvenir AWP | Dragon Lore (Factory New)')).toMatchObject({
|
|
weapon: 'AWP',
|
|
souvenir: 'yes'
|
|
});
|
|
expect(dimensionsFromName('Sticker | Crown (Foil)')).toMatchObject({
|
|
category: 'sticker',
|
|
skin: 'Crown',
|
|
variant: 'Foil'
|
|
});
|
|
expect(dimensionsFromName('Revolution Case')).toMatchObject({ category: 'container' });
|
|
});
|
|
});
|