mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-04 01:29:21 +00:00
Added tests for ensuring user gets 100 points
This commit is contained in:
parent
ff1f63da9a
commit
5573689d4e
1 changed files with 50 additions and 0 deletions
50
test/common/user.fns.updateStats.test.js
Normal file
50
test/common/user.fns.updateStats.test.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* eslint-disable camelcase */
|
||||
import {
|
||||
generateUser,
|
||||
} from '../helpers/common.helper';
|
||||
|
||||
describe('user.fns.updateStats', () => {
|
||||
let user;
|
||||
|
||||
beforeEach(() => {
|
||||
user = generateUser({
|
||||
stats: {
|
||||
int: 20,
|
||||
str: 20,
|
||||
con: 20,
|
||||
per: 20,
|
||||
lvl: 20,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
context('Stat Allocation', () => {
|
||||
it('Adds an attibute point when user\'s stat points are less than max level', () => {
|
||||
let stats = {
|
||||
exp: 3581,
|
||||
};
|
||||
|
||||
user.stats.lvl = 99;
|
||||
user.stats.str = 25;
|
||||
user.stats.int = 25;
|
||||
user.stats.con = 25;
|
||||
user.stats.per = 24;
|
||||
user.fns.updateStats(stats);
|
||||
expect(user.stats.points).to.eql(1);
|
||||
});
|
||||
|
||||
it('Does not add an attibute point when user\'s stat points are equal to max level', () => {
|
||||
let stats = {
|
||||
exp: 3581,
|
||||
};
|
||||
|
||||
user.stats.lvl = 99;
|
||||
user.stats.str = 25;
|
||||
user.stats.int = 25;
|
||||
user.stats.con = 25;
|
||||
user.stats.per = 25;
|
||||
user.fns.updateStats(stats);
|
||||
expect(user.stats.points).to.eql(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue