Skip to content

Commit

Permalink
Fixed tests in ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Caden Marinozzi committed Apr 5, 2024
1 parent 32fb769 commit f192657
Showing 1 changed file with 36 additions and 16 deletions.
52 changes: 36 additions & 16 deletions src/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
import MarketHashNameBuilder from '../../dist/index';

const tests = {
'karambit doppler factorynew': '★ Karambit | Doppler (Factory New)',
'aK-47 case Hardened FT': 'AK-47 | Case Hardened (Field-Tested)',
'AWP | Asiimov (Field-Tested)': 'AWP | Asiimov (Field-Tested)',
'Hydra Case key': 'Operation Hydra Case Key',
'titan Holo sticker katowice 2014':
'Sticker | Titan (Holo) | Katowice 2014',
'Fracture Case Key': 'Operation Fracture Case Key',
'm9 bayonet': '★ M9 Bayonet',
'Specialist Gloves fade FN': '★ Specialist Gloves | Fade (Factory New)',
const testTypes = {
weapons: {
'aK-47 case Hardened FT': 'AK-47 | Case Hardened (Field-Tested)',
'AWP | Asiimov (Field-Tested)': 'AWP | Asiimov (Field-Tested)',
},
knives: {
'karambit doppler factorynew': '★ Karambit | Doppler (Factory New)',
'phase 2 butterfly knife slaughter fn':
'★ Butterfly Knife | Slaughter (Factory New)',
'm9 bayonet': '★ M9 Bayonet',
},
stickers: {
'titan Holo sticker katowice 2014':
'Sticker | Titan (Holo) | Katowice 2014',
},
gloves: {
'Specialist Gloves fade FN': '★ Specialist Gloves | Fade (Factory New)',
'Bloodhound Gloves Charred FT':
'★ Bloodhound Gloves | Charred (Field-Tested)',
},
cases: {
'chroma 2 case': 'Operation Chroma 2 Case',
'operation shattered web case': 'Operation Shattered Web Case',
},
'case keys': {
'Hydra Case key': 'Operation Hydra Case Key',
'Fracture Case Key': 'Operation Fracture Case Key',
},
};

for (const [input, expected] of Object.entries(tests)) {
test(input, () => {
const builder = new MarketHashNameBuilder();
const result = builder.build(input);
expect(result).toBe(expected);
});
for (const [type, tests] of Object.entries(testTypes)) {
for (const [input, expected] of Object.entries(tests)) {
test(`${type}: ${input}`, () => {
const builder = new MarketHashNameBuilder();
const result = builder.build(input);
expect(result).toBe(expected);
});
}
}

0 comments on commit f192657

Please sign in to comment.