UNPKG

osumodcalculator

Version:

osu! calculator for converting values to DT & HT and other things

79 lines (78 loc) 2.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const __1 = require(".."); test('acr->int', () => { const fn = __1.mod.toInt; let i = fn(['EZ', 'HD', 'DT']); // => 74 expect(i).toBe(74); }); test('int->acr', () => { const fn = __1.mod.intToAcronym; let i = fn(88); // => ['HD', 'DT', 'HR'] expect(i.includes('HD')).toBe(true); expect(i.includes('HR')).toBe(true); expect(i.includes('DT')).toBe(true); expect(i.includes('EZ')).toBe(false); }); test('full->acr', () => { const fn = __1.mod.nameToAcronym; const mods = ['Fade In', 'Magnetised', 'Single Tap']; let out = fn(mods); // => ['FI', 'MG', 'SG] expect(out.length).toBe(3); expect(out[0]).toBe('FI'); expect(out[1]).toBe('MG'); expect(out[2]).toBe('SG'); }); test('acr->full', () => { const fn = __1.mod.acronymToName; const mods = ['ST', 'AC', 'TP']; let out = fn(mods); // => ['Strict Tracking', 'Accuracy Challenge','Target Practice'] expect(out.length).toBe(3); expect(out[0]).toBe('Strict Tracking'); expect(out[1]).toBe('Accuracy Challenge'); expect(out[2]).toBe('Target Practice'); }); test('duplicate', () => { const fn = __1.mod.removeDupe; const mods = ['HD', 'DT', 'HR', 'DT']; let out = fn(mods); // => ['HD','DT','HR'] expect(out.length).toBe(3); expect(out[0]).toBe('HD'); expect(out[1]).toBe('DT'); expect(out[2]).toBe('HR'); }); test('order', () => { const fn = __1.mod.order; const mods = ['DT', 'HR', 'HD',]; let out = fn(mods); // => ['HD','DT','HR'] expect(out.length).toBe(3); expect(out[0]).toBe('HD'); expect(out[1]).toBe('DT'); expect(out[2]).toBe('HR'); }); test('incompatible', () => { const fn = __1.mod.removeIncompatible; const mods = ['4K', 'FI', 'EZ', 'HD', 'DT', 'NC', 'HR']; const fixed = fn(mods); // => ['EZ', 'HD', 'DT'] expect(fixed.length).toBe(3); expect(fixed[0]).toBe('EZ'); expect(fixed[1]).toBe('HD'); expect(fixed[2]).toBe('DT'); }); test('fix all', () => { const fn = __1.mod.fix; const mods = ['DT', 'HR', 'HD', 'EZ', '4K', 'HD']; const fixed = fn(mods); expect(fixed.length).toBe(3); expect(fixed[0]).toBe('HD'); expect(fixed[1]).toBe('DT'); expect(fixed[2]).toBe('HR'); }); test('from string', () => { const mods = 'HDDTHR'; const fixed = __1.mod.fromString(mods); // => ['HD','DT','HR'] expect(fixed.length).toBe(3); expect(fixed[0]).toBe('HD'); expect(fixed[1]).toBe('DT'); expect(fixed[2]).toBe('HR'); });