mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Creates initial PUT /user test
This commit is contained in:
27
test/api/user/PUT-user.test.js
Normal file
27
test/api/user/PUT-user.test.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import {
|
||||||
|
generateUser,
|
||||||
|
requester,
|
||||||
|
} from '../../helpers/api.helper';
|
||||||
|
|
||||||
|
describe('PUT /user', () => {
|
||||||
|
let api, user;
|
||||||
|
|
||||||
|
beforeEach((done) => {
|
||||||
|
generateUser().then((usr) => {
|
||||||
|
user = usr;
|
||||||
|
api = requester(usr);
|
||||||
|
done();
|
||||||
|
}).catch(done);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("updates the user", () => {
|
||||||
|
let api = requester(user);
|
||||||
|
return api.get('/user')
|
||||||
|
.then((fetchedUser) => {
|
||||||
|
return api.put("/user", {"profile.name" : "Frodo"});
|
||||||
|
})
|
||||||
|
.then((updatedUser) => {
|
||||||
|
expect(updatedUser.profile.name).to.eql("Frodo");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import {
|
|
||||||
generateUser,
|
|
||||||
requester,
|
|
||||||
} from '../../helpers/api.helper';
|
|
||||||
|
|
||||||
describe('PUT /user', () => {
|
|
||||||
let api, user;
|
|
||||||
|
|
||||||
beforeEach((done) => {
|
|
||||||
generateUser().then((usr) => {
|
|
||||||
user = usr;
|
|
||||||
api = requester(usr);
|
|
||||||
done();
|
|
||||||
}).catch(done);
|
|
||||||
});
|
|
||||||
//
|
|
||||||
// it('gets the user object', (done) => {
|
|
||||||
// api.get('/user')
|
|
||||||
// .then((fetchedUser) => {
|
|
||||||
// expect(fetchedUser._id).to.eql(user._id);
|
|
||||||
// expect(fetchedUser.todos).to.eql(user.todos);
|
|
||||||
// done();
|
|
||||||
// })
|
|
||||||
// .catch((err) => {
|
|
||||||
// done(err);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
it("it works", () => {
|
|
||||||
expect(1).to.eql(1);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user