slop game oder so
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { CooldownTracker } from '../../app/static/js/logic/cooldowns.js';
|
||||
|
||||
describe('CooldownTracker', () => {
|
||||
it('ist für unbekannte Fähigkeiten sofort bereit', () => {
|
||||
const cd = new CooldownTracker();
|
||||
expect(cd.isReady('dodge', 0)).toBe(true);
|
||||
expect(cd.remaining('dodge', 0)).toBe(0);
|
||||
expect(cd.progress('dodge', 0)).toBe(1);
|
||||
});
|
||||
|
||||
it('läuft nach dem Auslösen ab', () => {
|
||||
const cd = new CooldownTracker();
|
||||
cd.trigger('dodge', 1000, 5000);
|
||||
expect(cd.isReady('dodge', 5000)).toBe(false);
|
||||
expect(cd.remaining('dodge', 5250)).toBe(750);
|
||||
expect(cd.progress('dodge', 5250)).toBeCloseTo(0.25);
|
||||
expect(cd.isReady('dodge', 6000)).toBe(true);
|
||||
expect(cd.progress('dodge', 9000)).toBe(1);
|
||||
});
|
||||
|
||||
it('verwaltet mehrere Fähigkeiten unabhängig', () => {
|
||||
const cd = new CooldownTracker();
|
||||
cd.trigger('a', 100, 0);
|
||||
cd.trigger('b', 1000, 0);
|
||||
expect(cd.isReady('a', 150)).toBe(true);
|
||||
expect(cd.isReady('b', 150)).toBe(false);
|
||||
});
|
||||
|
||||
it('lässt sich zurücksetzen', () => {
|
||||
const cd = new CooldownTracker();
|
||||
cd.trigger('a', 100, 0);
|
||||
cd.trigger('b', 100, 0);
|
||||
cd.reset('a');
|
||||
expect(cd.isReady('a', 0)).toBe(true);
|
||||
expect(cd.isReady('b', 0)).toBe(false);
|
||||
cd.reset();
|
||||
expect(cd.isReady('b', 0)).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user