Skip to content

Instantly share code, notes, and snippets.

@colwem
Created February 25, 2016 23:51
Show Gist options
  • Select an option

  • Save colwem/b7697fef4ffc3cefe75c to your computer and use it in GitHub Desktop.

Select an option

Save colwem/b7697fef4ffc3cefe75c to your computer and use it in GitHub Desktop.
output of running tests
vagrant@habitrpg:/vagrant$ gulp test
[23:37:32] Using gulpfile /vagrant/gulpfile.js
[23:37:34] Starting 'test:all'...
[23:37:34] Starting 'lint:server'...
[23:37:36] Starting 'lint:common'...
[23:37:36] Starting 'lint:tests'...
[23:37:37] Finished 'lint:server' after 3.22 s
[23:37:58] Finished 'lint:common' after 22 s
[23:37:59] Finished 'lint:tests' after 23 s
[23:37:59] Starting 'lint'...
[23:37:59] Finished 'lint' after 8.63 μs
[23:37:59] Starting 'test:prepare:build'...
[23:39:33] Finished 'test:prepare:build' after 1.55 min
[23:39:33] Starting 'test:common:safe'...
> [email protected] test:common /vagrant
> mocha test/common
User
✓ calculates max MP
✓ handles perfect days
Resting in the Inn
✓ remains in the inn on cron
✓ resets dailies
✓ resets checklist on incomplete dailies
✓ resets checklist on complete dailies
✓ does not reset checklist on grey incomplete dailies
✓ resets checklist on complete grey complete dailies
✓ does not damage user for incomplete dailies
✓ gives credit for complete dailies
✓ damages user for incomplete dailies after checkout
Death
✓ revives correctly
✓ doesn't break unbreakables
✓ handles event items
Rebirth
✓ removes correct gear
store
✓ buys a Quest scroll
✓ does not buy Quests without enough Gold
✓ does not buy nonexistent Quests
✓ does not buy Gem-premium Quests
Gem purchases
✓ does not purchase items without enough Gems
✓ purchases an egg
✓ purchases fox ears
✓ unlocks all the animal ears at once
spells
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values (39ms)
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
✓ function func(lang) {
return _i18n2['default'].t(string, vars, lang);
} has valid values
drop system
✓ drops a hatching potion (333ms)
✓ drops a pet egg (41ms)
✓ drops food
✓ does not get a drop
Quests
✓ The Dread Drag'on of Dilatory has valid values
✓ The Abominable Stressbeast of the Stoïkalm Steppes has valid values
✓ Burnout and the Exhaust Spirits has valid values
✓ Trapper Santa has valid values
✓ Find The Cub has valid values (48ms)
✓ The Fiery Gryphon has valid values
✓ The Hedgebeast has valid values
✓ The Spirit of Spring has valid values
✓ Vice, Part 1: Free Yourself of the Dragon's Influence has valid values
✓ Vice, Part 2: Find the Lair of the Wyrm has valid values
✓ Vice, Part 3: Vice Awakens has valid values
✓ Egg Hunt has valid values
✓ The Rat King has valid values
✓ The Call of Octothulu has valid values (68ms)
✓ The Dilatory Derby has valid values
✓ Attack of the Mundane, Part 1: Dish Disaster! has valid values
✓ Attack of the Mundane, Part 2: The SnackLess Monster has valid values
✓ Attack of the Mundane, Part 3: The Laundromancer has valid values
✓ Help! Harpy! has valid values
✓ Rooster Rampage has valid values
✓ The Icy Arachnid has valid values
✓ The Moonstone Chain, Part 1: The Moonstone Chain has valid values
✓ The Moonstone Chain, Part 2: Recidivate The Necromancer has valid values
✓ The Moonstone Chain, Part 3: Recidivate Transformed has valid values (174ms)
✓ The Golden Knight, Part 1: A Stern Talking-To has valid values
✓ The Golden Knight, Part 2: Gold Knight has valid values
✓ The Golden Knight, Part 3: The Iron Knight has valid values (129ms)
✓ The Basi-List has valid values (196ms)
✓ The Night-Owl has valid values
✓ The Fowl Frost has valid values
✓ King of the Dinosaurs has valid values
✓ The Dinosaur Unearthed has valid values
✓ Escape the Cave Creature has valid values
✓ The Killer Bunny has valid values
✓ The Jelly Regent has valid values
✓ The Thunder Ram has valid values
✓ The Kraken of Inkomplete has valid values
✓ Wail of the Whale has valid values
✓ Dilatory Distress, Part 1: Message in a Bottle has valid values
✓ Dilatory Distress, Part 2: Creatures of the Crevasse has valid values (55ms)
✓ Dilatory Distress, Part 3: Not a Mere Maid has valid values
✓ Such a Cheetah has valid values
✓ Ride the Night-Mare has valid values
✓ Swamp of the Clutter Frog has valid values
✓ The Serpent of Distraction has valid values
✓ Convincing the Unicorn Queen has valid values
✓ The Sabre Cat has valid values
✓ Monstrous Mandrill and the Mischief Monkeys has valid values
Achievements
✓ does not get ultimateGear warrior
- gets ultimateGear warrior
✓ does not get ultimateGear rogue
- gets ultimateGear rogue
✓ does not get ultimateGear healer (50ms)
- gets ultimateGear healer
✓ does not get ultimateGear wizard
- gets ultimateGear wizard
✓ does not remove existing Ultimate Gear achievements
unlocking features
✓ unlocks drops at level 3
✓ unlocks Rebirth at level 50
level-awarded Quests
✓ gets Attack of the Mundane at level 15
✓ gets Vice at level 30
✓ gets Golden Knight at level 40
✓ gets Moonstone Chain at level 60
Simple Scoring
✓ Habits : Up
✓ Habits : Down
✓ Dailys : Up
✓ Dailys : Up, Down
✓ Todos : Up
✓ Todos : Up, Down
Cron
✓ computes shouldCron
✓ only dailies & todos are affected (40ms)
preening
Deprecation warning: moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.
✓ should preen user history (67ms)
Todos
✓ 1 day missed (44ms)
✓ 2 days missed
cron day calculations
✓ startOfDay before dayStart
✓ startOfDay after dayStart
✓ daysSince cron before, now after
✓ daysSince cron before, now before
✓ daysSince cron after, now after
✓ daysSince cron after, now tomorrow before
✓ daysSince cron after, now tomorrow after
- daysSince, last cron before new dayStart
dailies
new day
✓ due yesterday(simple) (159ms)
✓ due yesterdaydue todaypre-dayStartchecked (70ms)
✓ due yesterdaydue todaypre-dayStartun-checked (97ms)
✓ due yesterdaydue todaypost-dayStartchecked (103ms)
✓ due yesterdaydue todaypost-dayStartunchecked (68ms)
✓ due yesterdayNOT due todaypre-dayStartchecked (45ms)
✓ due yesterdayNOT due todaypre-dayStartun-checked (69ms)
✓ due yesterdayNOT due todaypost-dayStartchecked (125ms)
✓ due yesterdayNOT due todaypost-dayStartunchecked (104ms)
✓ not due yesterday(simple) (118ms)
✓ not due yesterdaypost-dayStart (104ms)
✓ not due yesterdaypre-dayStart (54ms)
Helper
✓ calculates gold coins
✓ calculates silver coins
✓ calculates experience to next level
✓ calculates the start of the day
count
beastMasterProgress
✓ returns 0 if no pets
✓ counts drop pets
✓ does not count quest pets
✓ does not count pets hatched with premium potions
✓ does not count special pets
✓ counts drop pets that have been raised to a mount
✓ does not counts drop pets that have been released
mountMasterProgress
✓ returns 0 if no mounts
✓ counts drop mounts
✓ does not count premium mounts
✓ does not count quest mounts
✓ does not count special mounts
✓ only counts drop mounts that are currently owned
remainingGearInSet
✓ counts remaining gear based on set
- includes previously owned items in count (https: //github.com/HabitRPG/habitrpg/issues/5624#issuecomment-124018717)
dropPetsCurrentlyOwned
✓ counts drop pets owned
✓ does not count pets that have been raised to mounts
✓ does not count quest pets
✓ does not count special pets
questsOfCategory
✓ counts user quest scrolls of a particular category
daily/weekly that repeats everyday (default)
when startDate is in the future
✓ does not damage user for not completing it
✓ does not change value on cron if daily is incomplete
✓ does not reset checklists if daily is not marked as complete
✓ resets checklists if daily is marked as complete
✓ is due on startDate
when startDate is in the past
✓ does damage user for not completing it
✓ decreases value on cron if daily is incomplete
✓ decreases value on cron once only if daily is incomplete and multiple days are missed
✓ resets checklists if daily is not marked as complete
✓ resets checklists if daily is marked as complete
when startDate is today
✓ does damage user for not completing it
✓ decreases value on cron if daily is incomplete
✓ resets checklists if daily is not marked as complete
✓ resets checklists if daily is marked as complete
daily that repeats every x days
✓ where x equals 0 (57ms)
✓ where x equals 1
✓ where x equals 2 (57ms)
✓ where x equals 3
✓ where x equals 4 (57ms)
✓ where x equals 5 (68ms)
✓ where x equals 6 (45ms)
✓ where x equals 7 (61ms)
✓ where x equals 8
✓ where x equals 9 (71ms)
✓ where x equals 10 (70ms)
daily that repeats every X days when multiple days are missed
including missing a due date
✓ decreases value on cron once only if daily is incomplete
✓ resets checklists if daily is incomplete
✓ resets checklists if daily is marked as complete
but not missing a due date
✓ does not decrease value on cron
✓ does not reset checklists if daily is incomplete
✓ resets checklists if daily is marked as complete
#preenTodos
✓ includes uncompleted todos
✓ includes completed challenge todos
✓ includes recently completed todos
✓ includes todos completed two days ago
✓ does not include todos completed three days ago
✓ does not include todos completed more than three days ago
Spells
Rogue Spells
#backstab
✓ adds exp to user
✓ adds gp to user
✓ levels up user if the gain in experience will level up the user
✓ adds quest scroll to inventory when passing level milestone
Wizard Spells
#fireball (Burst of flames)
✓ adds exp to user
✓ levels up user if the gain in experience will level up the user
✓ adds quest scroll to inventory when passing level milestone
helper functions used in stat calculations
maxHealth
✓ provides a maximum Health value
maxLevel
✓ returns a maximum level for attribute gain
capByLevel
✓ returns level given if below cap
✓ returns level given if equal to cap
✓ returns level cap if above cap
toNextLevel
✓ increases Experience target from one level to the next
diminishingReturns
✓ provides a value under the maximum, given a bonus and maximum
✓ provides a value under the maximum, given a bonus, maximum, and halfway point
✓ provides a different curve if a halfway point is defined
user.fns.buy
Potion
✓ recovers 15 hp
✓ does not increase hp above 50
✓ deducts 25 gp
✓ does not purchase if not enough gp
Gear
✓ adds equipment to inventory
✓ deducts gold from user
✓ auto equips equipment if user has auto-equip preference turned on
✓ buys equipment but does not auto-equip
✓ removes one-handed weapon and shield if auto-equip is on and a two-hander is bought
✓ buys two-handed equipment but does not automatically remove sword or shield
✓ does not buy equipment without enough Gold
Quests
- buys a Quest scroll
- does not buy Quests without enough Gold
- does not buy nonexistent Quests
- does not buy Gem-premium Quests
Enchanted Armoire
failure conditions
✓ does not open if user does not have enough gold
✓ does not open without Ultimate Gear achievement
non-gear awards
✓ gives Experience
✓ gives food
✓ does not give equipment if all equipment has been found
gear awards
✓ always drops equipment the first time
✓ gives more equipment
User.fns.ultimateGear
✓ sets armoirEnabled when partial achievement already achieved
user.fns.updateStats
No Hp
✓ returns 0 if user's hp is 0
✓ returns 0 if user's hp is less than 0
✓ sets user's hp to 0 if it is less than 0
Stat Allocation
✓ adds only attribute points up to user's level
✓ adds an attibute point when user's stat points are less than max level
✓ does not add an attibute point when user's stat points are equal to max level
✓ does not add an attibute point when user's stat points + unallocated points are equal to max level
✓ only awards stat points up to level 100 if user is missing unallocated stat points and is over level 100
- auto allocates stats if automaticAllocation is turned on
user.ops.buyMysterySet
Mystery Sets
failure conditions
✓ does not grant mystery sets without Mystic Hourglasses
✓ does not grant mystery set that has already been purchased
successful purchases
✓ buys Steampunk Accessories Set
user.ops.equip
Gear
✓ should not send a message if a weapon is equipped while only having zero or one weapons equipped
✓ should send messages if equipping a two-hander causes the off-hander to be unequipped
✓ should send messages if equipping an off-hand item causes a two-handed weapon to be unequipped
user.ops.hatch
Pet Hatching
failure conditions
✓ does not allow hatching without specifying egg and potion
✓ does not allow hatching if user lacks specified egg
✓ does not allow hatching if user lacks specified hatching potion
✓ does not allow hatching if user already owns target pet
✓ does not allow hatching quest pet egg using premium potion
successful hatching
✓ hatches a basic pet
✓ hatches a quest pet
✓ hatches a premium pet
✓ hatches a pet previously raised to a mount
user.ops.hourglassPurchase
Time Travel Stable
failure conditions
✓ does not allow purchase of unsupported item types
✓ does not grant pets without Mystic Hourglasses
✓ does not grant mounts without Mystic Hourglasses
✓ does not grant pet that has already been purchased
✓ does not grant mount that has already been purchased
✓ does not grant pet that is not part of the Time Travel Stable
✓ does not grant mount that is not part of the Time Travel Stable
successful purchases
✓ buys a pet
✓ buys a mount
user.ops
readCard
✓ removes card from invitation array
✓ removes the first card from invitation array
274 passing (6s)
11 pending
[23:40:04] Finished 'test:common:safe' after 30 s
[23:40:04] Starting 'test:prepare:build'...
[23:40:51] Finished 'test:prepare:build' after 48 s
[23:40:51] Starting 'test:karma:safe'...
> [email protected] test:karma /vagrant
> karma start --single-run
START:
[BABEL] Note: The code generator has deoptimised the styling of "/vagrant/test/spec/mocks/translations.js" as it exceeds the max of "100KB".
[BABEL] Note: The code generator has deoptimised the styling of "/vagrant/test/spec/mocks/translations.js" as it exceeds the max of "100KB".
25 02 2016 23:41:22.519:INFO [karma]: Karma v0.13.21 server started at http://localhost:8080/
25 02 2016 23:41:22.651:INFO [launcher]: Starting browser PhantomJS
25 02 2016 23:41:26.178:ERROR [phantomjs.launcher]: 2016-02-25T23:41:26 [WARNING] phantomjs: cannot connect to X server :99
25 02 2016 23:41:26.266:ERROR [launcher]: Cannot start PhantomJS
25 02 2016 23:41:26.283:INFO [launcher]: Trying to start PhantomJS again (1/2).
25 02 2016 23:41:26.515:ERROR [phantomjs.launcher]: 2016-02-25T23:41:26 [WARNING] phantomjs: cannot connect to X server :99
25 02 2016 23:41:26.519:ERROR [launcher]: Cannot start PhantomJS
25 02 2016 23:41:26.521:INFO [launcher]: Trying to start PhantomJS again (2/2).
25 02 2016 23:41:26.597:ERROR [phantomjs.launcher]: 2016-02-25T23:41:26 [WARNING] phantomjs: cannot connect to X server :99
25 02 2016 23:41:26.606:ERROR [launcher]: Cannot start PhantomJS
25 02 2016 23:41:26.608:ERROR [launcher]: PhantomJS failed 2 times (cannot start). Giving up.
Finished in 0 secs / 0 secs
npm ERR! Linux 3.2.0-23-generic
npm ERR! argv "node" "/home/vagrant/.nvm/v0.10.40/bin/npm" "run" "test:karma"
npm ERR! node v0.10.40
npm ERR! npm v3.6.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test:karma: `karma start --single-run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test:karma script 'karma start --single-run'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the habitrpg package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! karma start --single-run
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs habitrpg
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls habitrpg
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /vagrant/npm-debug.log
[23:41:26] Finished 'test:karma:safe' after 35 s
[23:41:26] Starting 'test:prepare:mongo'...
[23:41:27] Finished 'test:prepare:mongo' after 439 ms
[23:41:27] Starting 'test:api-legacy:safe'...
> [email protected] test:api-legacy /vagrant
> istanbul cover -i "website/src/**" --dir coverage/api ./node_modules/mocha/bin/_mocha test/api-legacy
sh: 1: istanbul: not found
npm ERR! Linux 3.2.0-23-generic
npm ERR! argv "node" "/home/vagrant/.nvm/v0.10.40/bin/npm" "run" "test:api-legacy"
npm ERR! node v0.10.40
npm ERR! npm v3.6.0
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] test:api-legacy: `istanbul cover -i "website/src/**" --dir coverage/api ./node_modules/mocha/bin/_mocha test/api-legacy`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] test:api-legacy script 'istanbul cover -i "website/src/**" --dir coverage/api ./node_modules/mocha/bin/_mocha test/api-legacy'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the habitrpg package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! istanbul cover -i "website/src/**" --dir coverage/api ./node_modules/mocha/bin/_mocha test/api-legacy
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs habitrpg
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls habitrpg
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /vagrant/npm-debug.log
[23:41:27] Finished 'test:api-legacy:safe' after 747 ms
[23:41:27] Starting 'test:prepare:mongo'...
[23:41:28] Finished 'test:prepare:mongo' after 174 ms
[23:41:28] Starting 'test:prepare:server'...
[23:41:28] Finished 'test:prepare:server' after 20 ms
[23:41:28] Starting 'test:api-v2:safe'...
> [email protected] test:api-v2:integration /vagrant
> mocha test/api/v2 --recursive
GET /challenges/:id
Member of a challenge
1) "before all" hook: callee$2$0
GET /groups
no query passed in
- lists all public guilds, the tavern, user's party, and any private guilds that user is a part of - TODO query includes duplicates - IE, tavern is included as tavern and part of public guilds. Refactor so this is not the case
tavern passed in as query
✓ returns only the tavern (90ms)
party passed in as query
✓ returns only the user's party
public passed in as query
✓ returns all public guilds (46ms)
guilds passed in as query
✓ returns all guilds user is a part of
GET /groups/:id
Member of a public guild
✓ returns the group object (235ms)
✓ transforms members array to an array of user objects (139ms)
✓ transforms leader id to leader object (166ms)
✓ includes the user in the members list (159ms)
Member of a private guild
✓ returns the group object (122ms)
✓ transforms members array to an array of user objects (145ms)
✓ transforms leader id to leader object (290ms)
✓ includes the user in the members list (158ms)
Member of a party
✓ returns the group object (391ms)
✓ transforms members array to an array of user objects (371ms)
✓ transforms leader id to leader object (468ms)
✓ includes the user in the members list (492ms)
flagged messages
non-admin
✓ does not include messages with a flag count of 2 or greater (91ms)
✓ does not include user ids in flags object (41ms)
admin
✓ includes all messages (38ms)
✓ includes user ids in flags object (39ms)
Non-member of a public guild
✓ returns the group object for a non-member (95ms)
✓ does not include user in members list (73ms)
Private Guilds
✓ does not return the group object for a non-member
Non-member of a party
✓ does not return the group object for a non-member
Member of a party
✓ returns the user's party if an id of "party" is passed in (51ms)
Non-existent group
✓ returns error if group does not exist (40ms)
POST /groups
All groups
- returns defaults? (TODO: it's possible to create a group without a type. Should the group default to party? Should we require type to be set?
✓ returns a group object (56ms)
✓ returns a populated members array (54ms)
Parties
✓ allows party creation without gems (50ms)
✓ prevents party creation if user is already in party (62ms)
- prevents creating a public party. TODO: it is possible to create a public party. Should we send back an error? Automatically switch the privacy to private?
Guilds
✓ prevents guild creation when user does not have enough gems (107ms)
✓ can create a public guild (87ms)
✓ can create a private guild (178ms)
✓ deducts gems from user and adds them to guild bank (86ms)
POST /groups/:id
user is not the leader of the group
✓ does not allow user to update group
user is the leader of the group
✓ allows user to update group (88ms)
POST /groups/:id/join
user is already a member of the group
- returns an error
user has invitation to a public guild
✓ allows user to join a public guild (63ms)
user has invitation to a private guild
✓ allows user to join a private guild (70ms)
user has invitation to a party
✓ allows user to join a party (204ms)
user does not have an invitation to a private guild
✓ does not allow user to join a private guild (49ms)
user does not have an invitation to a party
✓ does not allow user to join a party
user does not have an invitation to a public group
✓ allows user to join a public guild (55ms)
public guild has no leader
✓ makes the joining user the leader (88ms)
POST /groups/:id/leave
user is not member of the group
- returns an error
user is a non-leader member of a guild
✓ leaves the group
user is the last member of a public guild
✓ leaves the group accessible (68ms)
user is the last member of a private group
✓ group is deleted (96ms)
user is the last member of a private group with pending invites
✓ deletes the group invitations from users (341ms)
user is the last member of a party with pending invites
✓ deletes the group invitations from users (100ms)
POST /groups/:id/removeMember
user is not member of the group
- returns an error
user is a non-leader member of a guild
- returns an error
user is the leader of a guild
✓ does not allow leader to remove themselves
✓ can remove other members of guild (63ms)
DELETE /groups/:id/chat
✓ deletes a message (102ms)
✓ returns an error is message does not exist (67ms)
GET /groups/:id/chat
group with multiple messages
✓ gets messages (166ms)
POST /groups/:id/chat
✓ creates a chat message (60ms)
✓ does not post an empty message (43ms)
POST /groups/:id/chat/:id/clearflags
non admin
✓ cannot clear flags
admin
✓ clears flags (420ms)
✓ leaves old flags on the flag object (188ms)
✓ returns error if message does not exist (40ms)
admin user, group with multiple messages
✓ changes only the message that is flagged (227ms)
POST /groups/:id/chat/:id/flag
another member's message
✓ flags message (194ms)
✓ cannot flag the same message twice (636ms)
own message
✓ cannot flag message (134ms)
nonexistant message
✓ returns error
group with multiple messages
✓ changes only the message that is flagged (138ms)
admin flagging a message
✓ sets flagCount to 5 (85ms)
POST /groups/:id/chat/:id/like
another member's message
✓ likes message
✓ returns the message object
own message
✓ cannot like message
group with multiple messages
✓ changes only the message that is liked (2369ms)
nonexistant message
✓ returns error (42ms)
POST /register
username and email are free
✓ registers a new user (377ms)
✓ requires password and confirmPassword to match
✓ requires a username
✓ requires an email
✓ requires a password
login is already taken
✓ rejects if username is already taken
✓ rejects if email is already taken
successful login via api
✓ sets all site tour values to -2 (already seen) (41ms)
✓ populates user with default todos, not no other task types (68ms)
✓ populates user with default tags (53ms)
successful login with habitica-web header
✓ sets all common tutorial flags to true (97ms)
✓ populates user with default todos, habits, and rewards
✓ populates user with default tags (48ms)
successful login with habitica-android header
✓ sets all common tutorial flags to true (62ms)
✓ populates user with default todos, habits, and rewards (58ms)
✓ populates user with default tags (64ms)
Status
✓ returns a status of up when server is up (91ms)
DELETE /user
✓ deletes the user (193ms)
user has active subscription
- does not delete account
last member of a party
✓ deletes party when user is the only member (165ms)
last member of a private guild
✓ deletes guild when user is the only member (302ms)
groups user is leader of
✓ chooses new group leader for any group user was the leader of (549ms)
groups user is a part of
✓ removes user from all groups user was a part of (118ms)
pending invitation to group
✓ removes invitations from groups (59ms)
GET /user
✓ gets the user object
✓ does not include password information
✓ does not include api token
GET /user/tags
✓ gets the user's tags (101ms)
GET /user/tags/id
✓ gets a user's tag by id (111ms)
✓ fails for non-existent tags
PUT /user
Allowed Operations
✓ updates the user (75ms)
Top Level Protected Operations
✓ does not allow updating gem balance (45ms)
✓ does not allow updating auth (69ms)
✓ does not allow updating contributor (57ms)
✓ does not allow updating backer (48ms)
✓ does not allow updating subscriptions (51ms)
✓ does not allow updating customization gem purchases (56ms)
✓ does not allow updating tasks (73ms)
Sub-Level Protected Operations
✓ does not allow updating class stat (57ms)
Default Appearance Preferences
✓ updates user with shirt that is a default (147ms)
✓ updates user with skin that is a default (57ms)
✓ updates user with hair.color that is a default (67ms)
✓ updates user with hair.bangs that is a default (56ms)
✓ updates user with hair.base that is a default (69ms)
✓ updates user with hair.flower that is a default (61ms)
✓ updates user with size that is a default (79ms)
✓ returns an error if user tries to update body size with invalid type
✓ can set beard to default (68ms)
✓ can set mustache to default (58ms)
Purchasable Appearance Preferences
✓ returns an error if user tries to update background with background the user does not own (55ms)
✓ updates user with background user does own (56ms)
✓ returns an error if user tries to update shirt with shirt the user does not own (48ms)
✓ updates user with shirt user does own (59ms)
✓ returns an error if user tries to update skin with skin the user does not own (56ms)
✓ updates user with skin user does own (80ms)
✓ returns an error if user tries to update hair.base with hair.base the user does not own (42ms)
✓ updates user with hair.base user does own (62ms)
✓ returns an error if user tries to update hair.beard with hair.beard the user does not own (54ms)
✓ updates user with hair.beard user does own (158ms)
✓ returns an error if user tries to update hair.color with hair.color the user does not own (56ms)
✓ updates user with hair.color user does own (56ms)
✓ returns an error if user tries to update hair.mustache with hair.mustache the user does not own (60ms)
✓ updates user with hair.mustache user does own (95ms)
GET /user/anonymized
✓ retains user id
✓ removes credentials and financial information
✓ removes profile information
✓ removes social information
✓ anonymizes task info
✓ anonymizes tags
✓ removes webhooks
POST /user/batch-update
allowed operations
✓ makes batch operations (230ms)
development only operations
✓ it sends back a 500 error for Add Ten Gems operation
✓ it sends back a 500 error for Add Hourglass operation
unknown operations
✓ sends back a 500 error
POST /user/pushDevice
✓ registers a device id (170ms)
DELETE /user/tasks/:id
✓ deletes a task (86ms)
✓ returns an error if the task does not exist (44ms)
✓ does not delete another user's task (59ms)
GET /user/tasks/
✓ gets all tasks
GET /user/tasks/:id
✓ gets a task (41ms)
✓ returns an error if the task does not exist
✓ does not get another user's task (44ms)
POST /user/tasks
✓ creates a task (40ms)
✓ creates a habit by default (56ms)
✓ creates a task with specified values
✓ does not create a task with an id that already exists
- TODO: no error is thrown - throws a 500 validation error if invalid type is posted
- TODO: no error is thrown - throws a 500 validation error if invalid data is posted
PUT /user/tasks/:id
✓ does not update the id of the task (57ms)
✓ does not update the type of the task (45ms)
✓ updates text, attribute, priority, value and notes
✓ returns an error if the task does not exist
✓ does not update another user's task (68ms)
161 passing (1m)
10 pending
1 failing
1) GET /challenges/:id Member of a challenge "before all" hook: callee$2$0:
Error: timeout of 8000ms exceeded. Ensure the done() callback is being called in this test.
npm ERR! Linux 3.2.0-23-generic
npm ERR! argv "node" "/home/vagrant/.nvm/v0.10.40/bin/npm" "run" "test:api-v2:integration"
npm ERR! node v0.10.40
npm ERR! npm v3.6.0
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test:api-v2:integration: `mocha test/api/v2 --recursive`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test:api-v2:integration script 'mocha test/api/v2 --recursive'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the habitrpg package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! mocha test/api/v2 --recursive
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs habitrpg
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls habitrpg
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /vagrant/npm-debug.log
[23:43:49] Finished 'test:api-v2:safe' after 2.35 min
[23:43:50] Finished 'test:all' after 6.27 min
[23:43:50] Starting 'test'...
Habitica Test Summary
Common Specs Passing: 274, Failed: 0, Pending: 11
Karma Specs Passing: 0, Failed: 0, Pending: 0
API (legacy) Specs Passing: 0, Failed: 0, Pending: 0
API Specs Passing: 161, Failed: 1, Pending: 10
Total: Passing: 435, Failed: 1, Pending: 21
ERROR: There are failing tests!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment