add lastDrop to helpers.newUser

This commit is contained in:
Dušan Juretić 2013-10-25 23:40:25 -03:00
parent dd79638bac
commit ecc8ff740e
2 changed files with 10 additions and 3 deletions

View file

@ -76,7 +76,7 @@ module.exports =
# _id / id handled by Racer
stats: { gp: 0, exp: 0, lvl: 1, hp: 50 }
invitations: {party:null, guilds: []}
items: { weapon: 0, armor: 0, head: 0, shield: 0 }
items: { weapon: 0, armor: 0, head: 0, shield: 0, lastDrop: { date: +new Date, count: 0 } }
preferences: { gender: 'm', skin: 'white', hair: 'blond', armorSet: 'v1', dayStart:0, showHelm: true }
apiToken: uuid() # set in newUserObject below
lastCron: +new Date #this will be replaced with `+new Date` on first run

View file

@ -75,7 +75,11 @@ describe 'User', ->
it 'sets correct user defaults', ->
user = helpers.newUser()
expect(user.stats).to.eql { gp: 0, exp: 0, lvl: 1, hp: 50 }
expect(user.items).to.eql { weapon: 0, armor: 0, head: 0, shield: 0 }
expect(user.items.weapon).to.eql 0
expect(user.items.armor).to.eql 0
expect(user.items.head).to.eql 0
expect(user.items.shield).to.eql 0
expect(user.items.lastDrop.count).to.eql 0
expect(user.preferences).to.eql { gender: 'm', skin: 'white', hair: 'blond', armorSet: 'v1', dayStart:0, showHelm: true }
expect(user.balance).to.eql 0
expect(user.lastCron).to.be.greaterThan 0
@ -95,7 +99,10 @@ describe 'User', ->
user.weapon = 1
algos.revive user
expect(user.stats).to.eql { gp: 0, exp: 0, lvl: 1, hp: 50 }
expect(user.items).to.eql { weapon: 0, armor: 0, head: 0, shield: 0 }
expect(user.items.weapon).to.eql 0
expect(user.items.armor).to.eql 0
expect(user.items.head).to.eql 0
expect(user.items.shield).to.eql 0
describe 'store', ->
it 'recovers hp buying potions', ->