aboutsummaryrefslogtreecommitdiff
path: root/test/test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.js')
-rw-r--r--test/test.js27
1 files changed, 26 insertions, 1 deletions
diff --git a/test/test.js b/test/test.js
index ad86ff7..e0e8b6c 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,5 +1,6 @@
globalThis.isTest = true
+const { levelForSkillXp } = require('../build/cleaners/skyblock/skills')
const hypixelCached = require('../build/hypixelCached')
const hypixelApi = require('../build/hypixelApi')
const constants = require('../build/constants')
@@ -149,5 +150,29 @@ describe('hypixel', () => {
})
})
-
+describe('Individual utility things', () => {
+ describe('#levelForSkillXp()', async() => {
+ it('0 xp is level 0', async() => assert.strictEqual(await levelForSkillXp(0, 60), 0))
+ it('49 xp is level 0', async() => assert.strictEqual(await levelForSkillXp(49, 60), 0))
+ it('50 xp is level 1', async() => assert.strictEqual(await levelForSkillXp(50, 60), 1))
+ it('174 xp is level 1', async() => assert.strictEqual(await levelForSkillXp(174, 60), 1))
+ it('175 xp is level 2', async() => assert.strictEqual(await levelForSkillXp(175, 60), 2))
+ it('176 xp is level 2', async() => assert.strictEqual(await levelForSkillXp(176, 60), 2))
+ it('55172424 xp is level 49', async() => assert.strictEqual(await levelForSkillXp(55172424, 60), 49))
+ it('55172425 xp is level 50', async() => assert.strictEqual(await levelForSkillXp(55172425, 60), 50))
+ it('111672424 xp is level 59', async() => assert.strictEqual(await levelForSkillXp(111672424, 60), 59))
+ it('111672425 xp is level 60', async() => assert.strictEqual(await levelForSkillXp(111672425, 60), 60))
+ it('999999999 xp is level 60', async() => assert.strictEqual(await levelForSkillXp(999999999, 60), 60))
+
+ it('0 xp is level 0 (max 25)', async() => assert.strictEqual(await levelForSkillXp(0, 25), 0))
+ it('49 xp is level 0 (max 25)', async() => assert.strictEqual(await levelForSkillXp(49, 25), 0))
+ it('50 xp is level 1 (max 25)', async() => assert.strictEqual(await levelForSkillXp(50, 25), 1))
+ it('149 xp is level 1 (max 25)', async() => assert.strictEqual(await levelForSkillXp(149, 25), 1))
+ it('150 xp is level 2 (max 25)', async() => assert.strictEqual(await levelForSkillXp(150, 25), 2))
+ it('151 xp is level 2 (max 25)', async() => assert.strictEqual(await levelForSkillXp(151, 25), 2))
+ it('94449 xp is level 24 (max 25)', async() => assert.strictEqual(await levelForSkillXp(94449, 25), 24))
+ it('94450 xp is level 25 (max 25)', async() => assert.strictEqual(await levelForSkillXp(94450, 25), 25))
+ it('99999 xp is level 25 (max 25)', async() => assert.strictEqual(await levelForSkillXp(99999, 25), 25))
+ })
+})