mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Removed balance check test (#10159)
* Removed balance check test * Removed balance check in common * Removed gem logic and added achievement to tests
This commit is contained in:
@@ -30,10 +30,12 @@ describe('POST /user/release-both', () => {
|
|||||||
'items.currentPet': animal,
|
'items.currentPet': animal,
|
||||||
'items.pets': loadPets(),
|
'items.pets': loadPets(),
|
||||||
'items.mounts': loadMounts(),
|
'items.mounts': loadMounts(),
|
||||||
|
'achievements.triadBingo': true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns an error when user balance is too low and user does not have triadBingo', async () => {
|
// @TODO: Traid is now free. Add this back if we need
|
||||||
|
xit('returns an error when user balance is too low and user does not have triadBingo', async () => {
|
||||||
await expect(user.post('/user/release-both'))
|
await expect(user.post('/user/release-both'))
|
||||||
.to.eventually.be.rejected.and.to.eql({
|
.to.eventually.be.rejected.and.to.eql({
|
||||||
code: 401,
|
code: 401,
|
||||||
@@ -45,9 +47,7 @@ describe('POST /user/release-both', () => {
|
|||||||
// More tests in common code unit tests
|
// More tests in common code unit tests
|
||||||
|
|
||||||
it('grants triad bingo with gems', async () => {
|
it('grants triad bingo with gems', async () => {
|
||||||
await user.update({
|
await user.update();
|
||||||
balance: 1.5,
|
|
||||||
});
|
|
||||||
|
|
||||||
let response = await user.post('/user/release-both');
|
let response = await user.post('/user/release-both');
|
||||||
await user.sync();
|
await user.sync();
|
||||||
|
|||||||
@@ -26,10 +26,11 @@ describe('shared.ops.releaseBoth', () => {
|
|||||||
|
|
||||||
user.items.currentMount = animal;
|
user.items.currentMount = animal;
|
||||||
user.items.currentPet = animal;
|
user.items.currentPet = animal;
|
||||||
user.balance = 1.5;
|
|
||||||
|
user.achievements.triadBingo = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns an error when user balance is too low and user does not have triadBingo', (done) => {
|
xit('returns an error when user balance is too low and user does not have triadBingo', (done) => {
|
||||||
user.balance = 0;
|
user.balance = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
import splitWhitespace from '../libs/splitWhitespace';
|
import splitWhitespace from '../libs/splitWhitespace';
|
||||||
import pick from 'lodash/pick';
|
import pick from 'lodash/pick';
|
||||||
|
|
||||||
module.exports = function releaseBoth (user, req = {}, analytics) {
|
module.exports = function releaseBoth (user, req = {}) {
|
||||||
let animal;
|
let animal;
|
||||||
|
|
||||||
if (!user.achievements.triadBingo) {
|
if (!user.achievements.triadBingo) {
|
||||||
@@ -22,19 +22,20 @@ module.exports = function releaseBoth (user, req = {}, analytics) {
|
|||||||
let giveBeastMasterAchievement = true;
|
let giveBeastMasterAchievement = true;
|
||||||
let giveMountMasterAchievement = true;
|
let giveMountMasterAchievement = true;
|
||||||
|
|
||||||
if (!user.achievements.triadBingo) {
|
// @TODO: We are only offering the free version now
|
||||||
if (analytics) {
|
// if (!user.achievements.triadBingo) {
|
||||||
analytics.track('release pets & mounts', {
|
// if (analytics) {
|
||||||
uuid: user._id,
|
// analytics.track('release pets & mounts', {
|
||||||
acquireMethod: 'Gems',
|
// uuid: user._id,
|
||||||
gemCost: 6,
|
// acquireMethod: 'Gems',
|
||||||
category: 'behavior',
|
// gemCost: 6,
|
||||||
headers: req.headers,
|
// category: 'behavior',
|
||||||
});
|
// headers: req.headers,
|
||||||
}
|
// });
|
||||||
|
// }
|
||||||
user.balance -= 1.5;
|
//
|
||||||
}
|
// user.balance -= 1.5;
|
||||||
|
// }
|
||||||
|
|
||||||
let mountInfo = content.mountInfo[user.items.currentMount];
|
let mountInfo = content.mountInfo[user.items.currentMount];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user