From 5573689d4eb9c3f7a6c95cc797db06d366b7c958 Mon Sep 17 00:00:00 2001 From: Keith Holliday Date: Sun, 13 Dec 2015 16:09:44 -0600 Subject: [PATCH] Added tests for ensuring user gets 100 points --- test/common/user.fns.updateStats.test.js | 50 ++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 test/common/user.fns.updateStats.test.js diff --git a/test/common/user.fns.updateStats.test.js b/test/common/user.fns.updateStats.test.js new file mode 100644 index 0000000000..8f641ea3a4 --- /dev/null +++ b/test/common/user.fns.updateStats.test.js @@ -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); + }); + }); +});