mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-26 21:24:08 +00:00
20 lines
551 B
JavaScript
20 lines
551 B
JavaScript
|
|
import percent from '../../../common/script/libs/percent';
|
||
|
|
|
||
|
|
describe('percent', () => {
|
||
|
|
it('with direction "up"', () => {
|
||
|
|
expect(percent(1, 10, 'up')).to.eql(10);
|
||
|
|
expect(percent(1, 20, 'up')).to.eql(5);
|
||
|
|
expect(percent(1.22, 10.99, 'up')).to.eql(12);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('with direction "down"', () => {
|
||
|
|
expect(percent(1, 10, 'down')).to.eql(10);
|
||
|
|
expect(percent(1, 20, 'down')).to.eql(5);
|
||
|
|
expect(percent(1.22, 10.99, 'down')).to.eql(11);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('with no direction', () => {
|
||
|
|
expect(percent(1.22, 10.99)).to.eql(11);
|
||
|
|
});
|
||
|
|
});
|