mirror of
https://github.com/yusufipk/RememberMe.git
synced 2026-09-11 10:56:07 +00:00
change(person/route) put, takes previous values if not specified by user
This commit is contained in:
@@ -191,9 +191,10 @@ describe("person route", () => {
|
||||
});
|
||||
});
|
||||
describe("PUT /api/person/:id", () => {
|
||||
let person;
|
||||
let person2;
|
||||
|
||||
beforeEach(() => {
|
||||
person = {
|
||||
person2 = {
|
||||
name: "Jimmy",
|
||||
place: "Texas",
|
||||
};
|
||||
@@ -203,7 +204,7 @@ describe("person route", () => {
|
||||
return await request(server)
|
||||
.put(`/api/person/${personId}`)
|
||||
.set({ "x-auth-token": token })
|
||||
.send(person);
|
||||
.send(person2);
|
||||
};
|
||||
|
||||
it("should return 401 if no token provided", async () => {
|
||||
@@ -224,18 +225,6 @@ describe("person route", () => {
|
||||
expect(res.status).toBe(404);
|
||||
});
|
||||
|
||||
it("joi should return 400 if input is invalid", async () => {
|
||||
person.name = "";
|
||||
const res = await exec();
|
||||
expect(res.status).toBe(400);
|
||||
});
|
||||
|
||||
it("joi should return 400 if input is invalid", async () => {
|
||||
person.place = "";
|
||||
const res = await exec();
|
||||
expect(res.status).toBe(400);
|
||||
});
|
||||
|
||||
it("should return 200 if input is valid", async () => {
|
||||
const res = await exec();
|
||||
expect(res.status).toBe(200);
|
||||
|
||||
Reference in New Issue
Block a user