Merge branch 'api-v3' into Alys-v3-armoire-fix
This commit is contained in:
@@ -108,7 +108,7 @@ describe('POST /tasks/user', () => {
|
||||
});
|
||||
|
||||
it(`ignores setting userId, history, createdAt,
|
||||
updatedAt, challenge, completed, streak,
|
||||
updatedAt, challenge, completed,
|
||||
dateCompleted fields`, async () => {
|
||||
let task = await user.post('/tasks/user', {
|
||||
text: 'test daily',
|
||||
@@ -119,7 +119,6 @@ describe('POST /tasks/user', () => {
|
||||
updatedAt: 'tomorrow',
|
||||
challenge: 'no',
|
||||
completed: true,
|
||||
streak: 25,
|
||||
dateCompleted: 'never',
|
||||
value: 324, // ignored because not a reward
|
||||
});
|
||||
@@ -130,7 +129,6 @@ describe('POST /tasks/user', () => {
|
||||
expect(task.updatedAt).not.to.equal('tomorrow');
|
||||
expect(task.challenge).not.to.equal('no');
|
||||
expect(task.completed).to.equal(false);
|
||||
expect(task.streak).to.equal(0);
|
||||
expect(task.streak).not.to.equal('never');
|
||||
expect(task.value).not.to.equal(324);
|
||||
});
|
||||
|
||||
@@ -18,6 +18,7 @@ describe('POST /user/buy-armoire', () => {
|
||||
await user.update({
|
||||
'stats.gp': 5,
|
||||
});
|
||||
|
||||
await expect(user.post('/user/buy-armoire'))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
@@ -28,6 +29,7 @@ describe('POST /user/buy-armoire', () => {
|
||||
|
||||
it('reduces gold when buying from the armoire', async () => {
|
||||
await user.post('/user/buy-armoire');
|
||||
|
||||
await user.sync();
|
||||
|
||||
expect(user.stats.gp).to.equal(300);
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ import shared from '../../../../../common/script';
|
||||
|
||||
let content = shared.content;
|
||||
|
||||
describe('POST /user/buy-potion', () => {
|
||||
describe('POST /user/buy-health-potion', () => {
|
||||
let user;
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -18,7 +18,7 @@ describe('POST /user/buy-potion', () => {
|
||||
// More tests in common code unit tests
|
||||
|
||||
it('returns an error if user does not have enough gold', async () => {
|
||||
await expect(user.post('/user/buy-potion'))
|
||||
await expect(user.post('/user/buy-health-potion'))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 401,
|
||||
error: 'NotAuthorized',
|
||||
@@ -32,7 +32,7 @@ describe('POST /user/buy-potion', () => {
|
||||
});
|
||||
|
||||
let potion = content.potion;
|
||||
let res = await user.post('/user/buy-potion');
|
||||
let res = await user.post('/user/buy-health-potion');
|
||||
await user.sync();
|
||||
|
||||
expect(user.stats.hp).to.equal(50);
|
||||
@@ -31,6 +31,7 @@ describe('POST /user/rebirth', () => {
|
||||
let daily = await generateDaily({
|
||||
text: 'test habit',
|
||||
type: 'daily',
|
||||
value: 1,
|
||||
streak: 1,
|
||||
userId: user._id,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user