Merge branch 'improve_tests' into api-v3

This commit is contained in:
Blade Barringer
2016-01-16 18:12:36 -06:00
145 changed files with 6398 additions and 6197 deletions

1
.gitignore vendored
View File

@@ -28,5 +28,6 @@ website/public/docs
coverage
coverage.html
common/dist/scripts/*
common/dist/sprites/habitrpg-shared.css
test/spec/mocks/translations.js

File diff suppressed because one or more lines are too long

View File

@@ -18,7 +18,7 @@
}
.2014_Fall_Warrior_PROMO {
background-image: url(spritesmith-largeSprites-0.png);
background-position: -452px -417px;
background-position: -306px -402px;
width: 90px;
height: 90px;
}
@@ -54,7 +54,7 @@
}
.promo_dilatoryDistress {
background-image: url(spritesmith-largeSprites-0.png);
background-position: -91px -1085px;
background-position: -364px -1085px;
width: 90px;
height: 90px;
}
@@ -78,7 +78,7 @@
}
.promo_enchanted_armoire_201509 {
background-image: url(spritesmith-largeSprites-0.png);
background-position: -364px -1085px;
background-position: -91px -1085px;
width: 90px;
height: 90px;
}
@@ -90,7 +90,7 @@
}
.promo_enchanted_armoire_201601 {
background-image: url(spritesmith-largeSprites-0.png);
background-position: -306px -402px;
background-position: -452px -417px;
width: 90px;
height: 90px;
}
@@ -318,13 +318,13 @@
}
.promo_springclasses2014 {
background-image: url(spritesmith-largeSprites-0.png);
background-position: -648px -724px;
background-position: -1119px 0px;
width: 288px;
height: 90px;
}
.promo_springclasses2015 {
background-image: url(spritesmith-largeSprites-0.png);
background-position: -1119px 0px;
background-position: -648px -724px;
width: 288px;
height: 90px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 213 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 KiB

After

Width:  |  Height:  |  Size: 274 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 61 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

After

Width:  |  Height:  |  Size: 152 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 98 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 142 KiB

View File

@@ -858,13 +858,13 @@
}
.headAccessory_mystery_301405 {
background-image: url(spritesmith-main-4.png);
background-position: -910px -1061px;
background-position: -1001px -1061px;
width: 90px;
height: 90px;
}
.head_mystery_301405 {
background-image: url(spritesmith-main-4.png);
background-position: -1001px -1061px;
background-position: -910px -1061px;
width: 90px;
height: 90px;
}
@@ -882,13 +882,13 @@
}
.shop_headAccessory_mystery_301405 {
background-image: url(spritesmith-main-4.png);
background-position: -1066px -1516px;
background-position: -1025px -1516px;
width: 40px;
height: 40px;
}
.shop_head_mystery_301405 {
background-image: url(spritesmith-main-4.png);
background-position: -1025px -1516px;
background-position: -1066px -1516px;
width: 40px;
height: 40px;
}
@@ -948,97 +948,97 @@
}
.headAccessory_special_spring2015Healer {
background-image: url(spritesmith-main-4.png);
background-position: 0px -1152px;
background-position: -728px -1152px;
width: 90px;
height: 90px;
}
.headAccessory_special_spring2015Mage {
background-image: url(spritesmith-main-4.png);
background-position: -91px -1152px;
background-position: -819px -1152px;
width: 90px;
height: 90px;
}
.headAccessory_special_spring2015Rogue {
background-image: url(spritesmith-main-4.png);
background-position: -182px -1152px;
background-position: -910px -1152px;
width: 90px;
height: 90px;
}
.headAccessory_special_spring2015Warrior {
background-image: url(spritesmith-main-4.png);
background-position: -273px -1152px;
background-position: -1001px -1152px;
width: 90px;
height: 90px;
}
.headAccessory_special_springHealer {
background-image: url(spritesmith-main-4.png);
background-position: -364px -1152px;
background-position: -1092px -1152px;
width: 90px;
height: 90px;
}
.headAccessory_special_springMage {
background-image: url(spritesmith-main-4.png);
background-position: -455px -1152px;
background-position: -1183px -1152px;
width: 90px;
height: 90px;
}
.headAccessory_special_springRogue {
background-image: url(spritesmith-main-4.png);
background-position: -546px -1152px;
background-position: -1300px 0px;
width: 90px;
height: 90px;
}
.headAccessory_special_springWarrior {
background-image: url(spritesmith-main-4.png);
background-position: -637px -1152px;
background-position: -1300px -91px;
width: 90px;
height: 90px;
}
.head_special_spring2015Healer {
background-image: url(spritesmith-main-4.png);
background-position: -728px -1152px;
background-position: 0px -1152px;
width: 90px;
height: 90px;
}
.head_special_spring2015Mage {
background-image: url(spritesmith-main-4.png);
background-position: -819px -1152px;
background-position: -91px -1152px;
width: 90px;
height: 90px;
}
.head_special_spring2015Rogue {
background-image: url(spritesmith-main-4.png);
background-position: -910px -1152px;
background-position: -182px -1152px;
width: 90px;
height: 90px;
}
.head_special_spring2015Warrior {
background-image: url(spritesmith-main-4.png);
background-position: -1001px -1152px;
background-position: -273px -1152px;
width: 90px;
height: 90px;
}
.head_special_springHealer {
background-image: url(spritesmith-main-4.png);
background-position: -1092px -1152px;
background-position: -364px -1152px;
width: 90px;
height: 90px;
}
.head_special_springMage {
background-image: url(spritesmith-main-4.png);
background-position: -1183px -1152px;
background-position: -455px -1152px;
width: 90px;
height: 90px;
}
.head_special_springRogue {
background-image: url(spritesmith-main-4.png);
background-position: -1300px 0px;
background-position: -546px -1152px;
width: 90px;
height: 90px;
}
.head_special_springWarrior {
background-image: url(spritesmith-main-4.png);
background-position: -1300px -91px;
background-position: -637px -1152px;
width: 90px;
height: 90px;
}
@@ -1128,97 +1128,97 @@
}
.shop_headAccessory_special_spring2015Healer {
background-image: url(spritesmith-main-4.png);
background-position: -615px -1516px;
background-position: -287px -1516px;
width: 40px;
height: 40px;
}
.shop_headAccessory_special_spring2015Mage {
background-image: url(spritesmith-main-4.png);
background-position: -574px -1516px;
background-position: -246px -1516px;
width: 40px;
height: 40px;
}
.shop_headAccessory_special_spring2015Rogue {
background-image: url(spritesmith-main-4.png);
background-position: -533px -1516px;
background-position: -205px -1516px;
width: 40px;
height: 40px;
}
.shop_headAccessory_special_spring2015Warrior {
background-image: url(spritesmith-main-4.png);
background-position: -492px -1516px;
background-position: -164px -1516px;
width: 40px;
height: 40px;
}
.shop_headAccessory_special_springHealer {
background-image: url(spritesmith-main-4.png);
background-position: -451px -1516px;
background-position: -123px -1516px;
width: 40px;
height: 40px;
}
.shop_headAccessory_special_springMage {
background-image: url(spritesmith-main-4.png);
background-position: -410px -1516px;
background-position: -82px -1516px;
width: 40px;
height: 40px;
}
.shop_headAccessory_special_springRogue {
background-image: url(spritesmith-main-4.png);
background-position: -369px -1516px;
background-position: -41px -1516px;
width: 40px;
height: 40px;
}
.shop_headAccessory_special_springWarrior {
background-image: url(spritesmith-main-4.png);
background-position: -328px -1516px;
background-position: 0px -1516px;
width: 40px;
height: 40px;
}
.shop_head_special_spring2015Healer {
background-image: url(spritesmith-main-4.png);
background-position: -287px -1516px;
background-position: -615px -1516px;
width: 40px;
height: 40px;
}
.shop_head_special_spring2015Mage {
background-image: url(spritesmith-main-4.png);
background-position: -246px -1516px;
background-position: -574px -1516px;
width: 40px;
height: 40px;
}
.shop_head_special_spring2015Rogue {
background-image: url(spritesmith-main-4.png);
background-position: -205px -1516px;
background-position: -533px -1516px;
width: 40px;
height: 40px;
}
.shop_head_special_spring2015Warrior {
background-image: url(spritesmith-main-4.png);
background-position: -164px -1516px;
background-position: -492px -1516px;
width: 40px;
height: 40px;
}
.shop_head_special_springHealer {
background-image: url(spritesmith-main-4.png);
background-position: -123px -1516px;
background-position: -451px -1516px;
width: 40px;
height: 40px;
}
.shop_head_special_springMage {
background-image: url(spritesmith-main-4.png);
background-position: -82px -1516px;
background-position: -410px -1516px;
width: 40px;
height: 40px;
}
.shop_head_special_springRogue {
background-image: url(spritesmith-main-4.png);
background-position: -41px -1516px;
background-position: -369px -1516px;
width: 40px;
height: 40px;
}
.shop_head_special_springWarrior {
background-image: url(spritesmith-main-4.png);
background-position: 0px -1516px;
background-position: -328px -1516px;
width: 40px;
height: 40px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 129 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 KiB

After

Width:  |  Height:  |  Size: 370 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 175 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 134 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 KiB

After

Width:  |  Height:  |  Size: 145 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -125,8 +125,9 @@
"mageText": "Mages learn swiftly, gaining Experience and Levels faster than other classes. They also get a great deal of Mana for using special abilities. Play a Mage if you enjoy the tactical game aspects of Habit, or if you are strongly motivated by leveling up and unlocking advanced features!",
"rogueText": "Rogues love to accumulate wealth, gaining more Gold than anyone else, and are adept at finding random items. Their iconic Stealth ability lets them duck the consequences of missed Dailies. Play a Rogue if you find strong motivation from Rewards and Achievements, striving for loot and badges!",
"healerText": "Healers stand impervious against harm, and extend that protection to others. Missed Dailies and bad Habits don't faze them much, and they have ways to recover Health from failure. Play a Healer if you enjoy assisting others in your Party, or if the idea of cheating Death through hard work inspires you!",
"optOut": "Opt Out",
"optOutText": "Can't be bothered with classes? Want to choose later? Opt out - you'll be a warrior with no special abilities. You can read about the class system later on the wiki and enable classes at any time under User -> Stats.",
"optOutOfClasses": "Opt Out",
"optOutOfPMs": "Opt Out",
"optOutOfClassesText": "Can't be bothered with classes? Want to choose later? Opt out - you'll be a warrior with no special abilities. You can read about the class system later on the wiki and enable classes at any time under User -> Stats.",
"select": "Select",
"stealth": "Stealth",
"stealthNewDay": "When a new day begins, you will avoid damage from this many missed Dailies.",

View File

@@ -147,6 +147,10 @@
"questEggUnicornMountText": "Winged Unicorn",
"questEggUnicornAdjective": "a magical",
"questEggSabretoothText": "Sabretooth Tiger",
"questEggSabretoothMountText": "Sabretooth Tiger",
"questEggSabretoothAdjective": "a ferocious",
"eggNotes": "Find a hatching potion to pour on this egg, and it will hatch into <%= eggAdjective(locale) %> <%= eggText(locale) %>.",
"hatchingPotionBase": "Base",

View File

@@ -325,5 +325,12 @@
"questUnicornCompletion": "Impressed by your diligence and strength, the Unicorn Queen at last agrees that your cause is worthy. She allows you to ride on her back as she soars to the source of Conquest Creek. As she lowers her golden horn to the befouled waters, a brilliant blue light rises from the waters surface. It is so blinding that you are forced to close your eyes. When you open them a moment later, the unicorn is gone. However, @rosiesully lets out a cry of delight: the water is now clear, and three shining eggs rest at the creeks edge.",
"questUnicornBoss": "The Unicorn Queen",
"questUnicornDropUnicornEgg": "Unicorn (Egg)",
"questUnicornUnlockText": "Unlocks purchasable Unicorn eggs in the Market"
"questUnicornUnlockText": "Unlocks purchasable Unicorn eggs in the Market",
"questSabretoothText": "The Sabre Cat",
"questSabretoothNotes": "A roaring monster is terrorizing Habitica! The creature stalks through the wilds and woods, then bursts forth to attack before vanishing again. It's been hunting innocent pandas and frightening the flying pigs into fleeing their pens to roost in the trees. @Inventrix and @icefelis explain that the Zombie Sabre Cat was set free while they were excavating in the ancient, untouched ice-fields of the Stoikalm Steppes. \"It was perfectly friendly at first I don't know what happened. Please, you have to help us recapture it! Only a champion of Habitica can subdue this prehistoric beast!\"",
"questSabretoothCompletion": "After a long and tiring battle, you wrestle the Zombie Sabre Cat to the ground. As you are finally able to approach, you notice a nasty cavity in one of its sabre teeth. Realising the true cause of the cat's wrath, you're able to get the cavity filled by @Fandekasp, and advise everyone to avoid feeding their friend sweets in future. The Sabre Cat flourishes, and in gratitude, its tamers send you a generous reward a clutch of sabretooth eggs!",
"questSabretoothBoss": "Zombie Sabre Cat",
"questSabretoothDropSabretoothEgg": "Sabretooth (Egg)",
"questSabretoothUnlockText": "Unlocks purchasable Sabretooth eggs in the Market"
}

View File

@@ -11,7 +11,6 @@
"dailyDueDefaultView": "Set Dailies default to 'due' tab",
"dailyDueDefaultViewPop": "With this option set, the Dailies tasks will default to 'due' instead of 'all'",
"reverseChatOrder": "Show chat messages in reverse order",
"reverseChatOrderPop": "Show the messages in the Tarvern, Guild, and Party chats in reverse order, so that the oldest are on top.",
"startCollapsed": "Tag list in tasks starts collapsed",
"startCollapsedPop": "With this option set, the list of task tags will be hidden when you first open a task for editing.",
"startAdvCollapsed": "Advanced Options in tasks start collapsed",

View File

@@ -932,6 +932,13 @@ api.questEggs = {
return u.achievements.quests && (u.achievements.quests.unicorn != null) > 0;
})
},
Sabretooth: {
text: t('questEggSabretoothText'),
adjective: t('questEggSabretoothAdjective'),
canBuy: (function(u) {
return u.achievements.quests && (u.achievements.quests.sabretooth != null) > 0;
})
},
};
_.each(api.questEggs, function(egg, key) {
@@ -2981,6 +2988,38 @@ api.quests = {
unlock: t('questUnicornUnlockText')
}
},
sabretooth: {
text: t('questSabretoothText'),
notes: t('questSabretoothNotes'),
completion: t('questSabretoothCompletion'),
value: 4,
category: 'pet',
boss: {
name: t('questSabretoothBoss'),
hp: 1000,
str: 2
},
drop: {
items: [
{
type: 'eggs',
key: 'Sabretooth',
text: t('questSabretoothDropSabretoothEgg')
}, {
type: 'eggs',
key: 'Sabretooth',
text: t('questSabretoothDropSabretoothEgg')
}, {
type: 'eggs',
key: 'Sabretooth',
text: t('questSabretoothDropSabretoothEgg')
}
],
gp: 67,
exp: 650,
unlock: t('questSabretoothUnlockText')
}
},
};
_.each(api.quests, function(v, key) {

View File

@@ -2,7 +2,7 @@ import {
generateGroup,
generateUser,
resetHabiticaDB,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
describe('GET /groups', () => {
const NUMBER_OF_PUBLIC_GUILDS = 3;
@@ -22,6 +22,7 @@ describe('GET /groups', () => {
name: 'public guild - is member',
type: 'guild',
privacy: 'public',
}, {
members: [leader._id, user._id],
});
@@ -35,6 +36,7 @@ describe('GET /groups', () => {
name: 'private guild - is member',
type: 'guild',
privacy: 'private',
}, {
members: [leader._id, user._id],
});

View File

@@ -2,7 +2,7 @@ import {
createAndPopulateGroup,
generateUser,
translate as t,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
import {
find,
each,
@@ -24,7 +24,7 @@ describe('GET /groups/:id', () => {
groupDetails,
});
leader = groupData.leader;
leader = groupData.groupLeader;
member = groupData.members[0];
createdGroup = groupData.group;
});

View File

@@ -2,7 +2,7 @@ import {
generateGroup,
generateUser,
translate as t,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
describe('POST /groups', () => {
context('All groups', () => {

View File

@@ -2,7 +2,7 @@ import {
generateGroup,
generateUser,
translate as t,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
describe('POST /groups/:id', () => {
context('user is not the leader of the group', () => {

View File

@@ -2,7 +2,7 @@ import {
createAndPopulateGroup,
generateUser,
translate as t,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
import { each, find } from 'lodash';
describe('POST /groups/:id/join', () => {
@@ -98,7 +98,7 @@ describe('POST /groups/:id/join', () => {
},
});
group = groupData.group;
await groupData.leader.post(`/groups/${group._id}/leave`);
await groupData.groupLeader.post(`/groups/${group._id}/leave`);
user = await generateUser();
});

View File

@@ -1,7 +1,7 @@
import {
checkExistence,
createAndPopulateGroup,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
import { find } from 'lodash';
describe('POST /groups/:id/leave', () => {
@@ -48,7 +48,7 @@ describe('POST /groups/:id/leave', () => {
},
});
user = groupData.leader;
user = groupData.groupLeader;
group = groupData.group;
});
@@ -71,7 +71,7 @@ describe('POST /groups/:id/leave', () => {
},
});
user = groupData.leader;
user = groupData.groupLeader;
group = groupData.group;
});
@@ -95,7 +95,7 @@ describe('POST /groups/:id/leave', () => {
},
});
user = groupData.leader;
user = groupData.groupLeader;
group = groupData.group;
invitee1 = groupData.invitees[0];
invitee2 = groupData.invitees[1];
@@ -122,7 +122,7 @@ describe('POST /groups/:id/leave', () => {
},
});
user = groupData.leader;
user = groupData.groupLeader;
group = groupData.group;
invitee1 = groupData.invitees[0];
invitee2 = groupData.invitees[1];

View File

@@ -1,7 +1,7 @@
import {
createAndPopulateGroup,
translate as t,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
describe('POST /groups/:id/removeMember', () => {
context('user is not member of the group', () => {
@@ -24,7 +24,7 @@ describe('POST /groups/:id/removeMember', () => {
privacy: 'public',
},
}).then((res) => {
leader = res.leader;
leader = res.groupLeader;
member = res.members[0];
group = res.group;
});

View File

@@ -1,7 +1,7 @@
import {
createAndPopulateGroup,
translate as t,
} from '../../../../helpers/api-integration.helper';
} from '../../../../helpers/api-integration/v2';
describe('DELETE /groups/:id/chat', () => {
let group, message, user;
@@ -14,7 +14,7 @@ describe('DELETE /groups/:id/chat', () => {
},
}).then((res) => {
group = res.group;
user = res.leader;
user = res.groupLeader;
return user.post(`/groups/${group._id}/chat`, null, { message: 'Some message' });
}).then((res) => {

View File

@@ -1,6 +1,6 @@
import {
createAndPopulateGroup,
} from '../../../../helpers/api-integration.helper';
} from '../../../../helpers/api-integration/v2';
describe('GET /groups/:id/chat', () => {
context('group with multiple messages', () => {
@@ -16,7 +16,7 @@ describe('GET /groups/:id/chat', () => {
});
group = groupData.group;
user = groupData.leader;
user = groupData.groupLeader;
member = groupData.members[0];
await member.post(`/groups/${group._id}/chat`, null, { message: 'Group member message' });

View File

@@ -1,7 +1,7 @@
import {
createAndPopulateGroup,
translate as t,
} from '../../../../helpers/api-integration.helper';
} from '../../../../helpers/api-integration/v2';
describe('POST /groups/:id/chat', () => {
let group, user;
@@ -14,7 +14,7 @@ describe('POST /groups/:id/chat', () => {
},
}).then((res) => {
group = res.group;
user = res.leader;
user = res.groupLeader;
});
});

View File

@@ -2,27 +2,26 @@ import {
createAndPopulateGroup,
generateUser,
translate as t,
} from '../../../../helpers/api-integration.helper';
} from '../../../../helpers/api-integration/v2';
describe('POST /groups/:id/chat/:id/clearflags', () => {
let group;
let guild;
beforeEach(async () => {
return createAndPopulateGroup({
let { group } = await createAndPopulateGroup({
groupDetails: {
type: 'guild',
privacy: 'public',
members: 1,
flagCount: 1,
chat: [{
id: 'message-to-clear',
flagCount: 1,
flags: { 'some-id': true },
}],
},
}).then((res) => {
group = res.group;
});
guild = group;
});
context('non admin', () => {
@@ -33,7 +32,7 @@ describe('POST /groups/:id/chat/:id/clearflags', () => {
});
it('cannot clear flags', async () => {
return expect(nonadmin.post(`/groups/${group._id}/chat/message-to-clear/clearflags`))
return expect(nonadmin.post(`/groups/${guild._id}/chat/message-to-clear/clearflags`))
.to.eventually.be.rejected.and.eql({
code: 401,
text: t('messageGroupChatAdminClearFlagCount'),
@@ -53,23 +52,23 @@ describe('POST /groups/:id/chat/:id/clearflags', () => {
});
it('clears flags', async () => {
return admin.post(`/groups/${group._id}/chat/message-to-clear/clearflags`).then(() => {
return admin.get(`/groups/${group._id}/chat`);
return admin.post(`/groups/${guild._id}/chat/message-to-clear/clearflags`).then(() => {
return admin.get(`/groups/${guild._id}/chat`);
}).then((messages) => {
expect(messages[0].flagCount).to.eql(0);
});
});
it('leaves old flags on the flag object', async () => {
return admin.post(`/groups/${group._id}/chat/message-to-clear/clearflags`).then(() => {
return admin.get(`/groups/${group._id}/chat`);
return admin.post(`/groups/${guild._id}/chat/message-to-clear/clearflags`).then(() => {
return admin.get(`/groups/${guild._id}/chat`);
}).then((messages) => {
expect(messages[0].flags).to.have.property('some-id', true);
});
});
it('returns error if message does not exist', async () => {
return expect(admin.post(`/groups/${group._id}/chat/non-existant-message/clearflags`))
return expect(admin.post(`/groups/${guild._id}/chat/non-existant-message/clearflags`))
.to.eventually.be.rejected.and.eql({
code: 404,
text: t('messageGroupChatNotFound'),

View File

@@ -2,7 +2,7 @@ import {
createAndPopulateGroup,
generateUser,
translate as t,
} from '../../../../helpers/api-integration.helper';
} from '../../../../helpers/api-integration/v2';
describe('POST /groups/:id/chat/:id/flag', () => {
context('another member\'s message', () => {
@@ -17,7 +17,7 @@ describe('POST /groups/:id/chat/:id/flag', () => {
members: 1,
}).then((res) => {
group = res.group;
user = res.leader;
user = res.groupLeader;
member = res.members[0];
return member.post(`/groups/${group._id}/chat`, null, { message: 'Group member message' });
@@ -56,7 +56,7 @@ describe('POST /groups/:id/chat/:id/flag', () => {
},
}).then((res) => {
group = res.group;
user = res.leader;
user = res.groupLeader;
return user.post(`/groups/${group._id}/chat`, null, { message: 'User\'s own message' });
}).then((res) => {
@@ -84,7 +84,7 @@ describe('POST /groups/:id/chat/:id/flag', () => {
},
}).then((res) => {
group = res.group;
user = res.leader;
user = res.groupLeader;
});
});
@@ -121,7 +121,7 @@ describe('POST /groups/:id/chat/:id/flag', () => {
});
group = groupData.group;
user = groupData.leader;
user = groupData.groupLeader;
});
it('changes only the message that is flagged', async () => {
@@ -166,7 +166,7 @@ describe('POST /groups/:id/chat/:id/flag', () => {
members: 1,
}).then((res) => {
group = res.group;
user = res.leader;
user = res.groupLeader;
member = res.members[0];
return member.post(`/groups/${group._id}/chat`, null, { message: 'Group member message' });

View File

@@ -2,7 +2,7 @@ import {
createAndPopulateGroup,
generateUser,
translate as t,
} from '../../../../helpers/api-integration.helper';
} from '../../../../helpers/api-integration/v2';
describe('POST /groups/:id/chat/:id/like', () => {
context('another member\'s message', () => {
@@ -17,7 +17,7 @@ describe('POST /groups/:id/chat/:id/like', () => {
members: 1,
}).then((res) => {
group = res.group;
user = res.leader;
user = res.groupLeader;
member = res.members[0];
return member.post(`/groups/${group._id}/chat`, null, { message: 'Group member message' });
@@ -53,7 +53,7 @@ describe('POST /groups/:id/chat/:id/like', () => {
},
}).then((res) => {
group = res.group;
user = res.leader;
user = res.groupLeader;
return user.post(`/groups/${group._id}/chat`, null, { message: 'User\'s own message' });
}).then((res) => {
@@ -94,7 +94,7 @@ describe('POST /groups/:id/chat/:id/like', () => {
});
group = groupData.group;
user = groupData.leader;
user = groupData.groupLeader;
});
it('changes only the message that is liked', async () => {
@@ -134,7 +134,7 @@ describe('POST /groups/:id/chat/:id/like', () => {
},
}).then((res) => {
group = res.group;
user = res.leader;
user = res.groupLeader;
});
});

View File

@@ -2,7 +2,7 @@ import {
generateUser,
requester,
translate as t,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
import { v4 as generateRandomUserName } from 'uuid';
import { each } from 'lodash';

View File

@@ -1,4 +1,4 @@
import {requester} from '../../../helpers/api-integration.helper';
import {requester} from '../../../helpers/api-integration/v2';
describe('Status', () => {
it('returns a status of up when server is up', async () => {

View File

@@ -3,7 +3,7 @@ import {
createAndPopulateGroup,
generateGroup,
generateUser,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
import { find } from 'lodash';
describe('DELETE /user', () => {
@@ -36,28 +36,30 @@ describe('DELETE /user', () => {
});
it('deletes party when user is the only member', async () => {
return expect(user.del('/user').then(() => {
return checkExistence('groups', party._id);
})).to.eventually.eql(false);
await user.del('/user');
await expect(checkExistence('groups', party._id)).to.eventually.eql(false);
});
});
context('last member of a private guild', () => {
let guild;
let guild, lastMember;
beforeEach(async () => {
return generateGroup(user, {
let {
groupLeader,
group,
} = await createAndPopulateGroup({
type: 'guild',
privacy: 'private',
}).then((group) => {
guild = group;
});
guild = group;
lastMember = groupLeader;
});
it('deletes guild when user is the only member', async () => {
return expect(user.del('/user').then(() => {
return checkExistence('groups', guild._id);
})).to.eventually.eql(false);
await lastMember.del('/user');
await expect(checkExistence('groups', guild._id)).to.eventually.eql(false);
});
});
@@ -74,7 +76,7 @@ describe('DELETE /user', () => {
}).then((res) => {
group = res.group;
newLeader = res.members[0];
oldLeader = res.leader;
oldLeader = res.groupLeader;
});
});

View File

@@ -1,6 +1,6 @@
import {
generateUser,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
describe('GET /user', () => {
let user;

View File

@@ -1,6 +1,6 @@
import {
generateUser,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
describe('GET /user/tags', () => {
let user;

View File

@@ -1,7 +1,7 @@
import {
generateUser,
translate as t,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
describe('GET /user/tags/id', () => {
let user;

View File

@@ -1,7 +1,7 @@
import {
generateUser,
translate as t,
} from '../../../helpers/api-integration.helper';
} from '../../../helpers/api-integration/v2';
import { each, get } from 'lodash';

View File

@@ -1,6 +1,6 @@
import {
generateUser,
} from '../../../../helpers/api-integration.helper';
} from '../../../../helpers/api-integration/v2';
import { each } from 'lodash';
describe('GET /user/anonymized', () => {

View File

@@ -1,7 +1,7 @@
import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration.helper';
} from '../../../../helpers/api-integration/v2';
import { each } from 'lodash';

View File

@@ -1,6 +1,6 @@
import {
generateUser,
} from '../../../../helpers/api-integration.helper';
} from '../../../../helpers/api-integration/v2';
describe('POST /user/pushDevice', () => {
let user;

View File

@@ -1,7 +1,7 @@
import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration.helper';
} from '../../../../helpers/api-integration/v2';
describe('DELETE /user/tasks/:id', () => {
let user, task;

Some files were not shown because too many files have changed in this diff Show More