change response for shared.ops.sleep, save user in POST /user/sleep and add integration tests for it

This commit is contained in:
Matteo Pagliazzi
2016-03-15 17:05:07 +01:00
parent 490c6a9ae1
commit b2b4340ee3
4 changed files with 38 additions and 10 deletions

View File

@@ -0,0 +1,27 @@
import {
generateUser,
} from '../../../../helpers/api-integration/v3';
describe('POST /user/sleep', () => {
let user;
beforeEach(async () => {
user = await generateUser();
});
it('toggles sleep status', async () => {
let res = await user.post(`/user/sleep`);
expect(res).to.eql({
preferences: {sleep: true},
});
await user.sync();
expect(user.preferences.sleep).to.be.true;
let res2 = await user.post(`/user/sleep`);
expect(res2).to.eql({
preferences: {sleep: false},
});
await user.sync();
expect(user.preferences.sleep).to.be.false;
});
});