-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from atlp-rwanda/fix-stock-quantity-verify-user
fix: stock quantity update and verify user
- Loading branch information
Showing
5 changed files
with
33 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,8 +124,8 @@ describe("Testing product Routes", () => { | |
const token = generateVerificationToken('[email protected]', 60); | ||
const response = await request(app) | ||
.get(`/api/v1/users/verify-user?token=${token}`) | ||
expect(response.status).toBe(200) | ||
expect(response.body.message).toBe('User verified successfully.') | ||
expect(response.status).toBe(302); | ||
expect(response.headers.location).toBe(`${process.env.FE_URL}/verify-user`); | ||
},60000) | ||
|
||
test("should login an buyer", async () =>{ | ||
|
@@ -148,8 +148,8 @@ describe("Testing product Routes", () => { | |
const token = generateVerificationToken('[email protected]', 60); | ||
const response = await request(app) | ||
.get(`/api/v1/users/verify-user?token=${token}`) | ||
expect(response.status).toBe(200) | ||
expect(response.body.message).toBe('User verified successfully.') | ||
expect(response.status).toBe(302); | ||
expect(response.headers.location).toBe(`${process.env.FE_URL}/verify-user`); | ||
},60000) | ||
test("should login an Admin", async () =>{ | ||
const response = await request(app).post("/api/v1/users/login").send({ | ||
|
@@ -163,8 +163,8 @@ describe("Testing product Routes", () => { | |
const token = generateVerificationToken(dummySeller.email, 60); | ||
const response = await request(app) | ||
.get(`/api/v1/users/verify-user?token=${token}`) | ||
expect(response.status).toBe(200) | ||
expect(response.body.message).toBe('User verified successfully.') | ||
expect(response.status).toBe(302); | ||
expect(response.headers.location).toBe(`${process.env.FE_URL}/verify-user`); | ||
},60000) | ||
|
||
test("should update dummyseller's role to seller", async () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,9 +118,10 @@ describe("Testing user Routes", () => { | |
it("It should verify user account.",async()=>{ | ||
const token = generateVerificationToken(userData.email, 60); | ||
const response = await request(app) | ||
.get(`/api/v1/users/verify-user?token=${token}`) | ||
expect(response.status).toBe(200) | ||
expect(response.body.message).toBe('User verified successfully.') | ||
.get(`/api/v1/users/verify-user?token=${token}`) | ||
expect(response.status).toBe(302); | ||
expect(response.headers.location).toBe(`${process.env.FE_URL}/verify-user`); | ||
|
||
},60000) | ||
|
||
|
||
|
@@ -213,9 +214,10 @@ describe("Testing user Routes", () => { | |
it("It should verify user account.",async()=>{ | ||
const token = generateVerificationToken('[email protected]', 60); | ||
const response = await request(app) | ||
.get(`/api/v1/users/verify-user?token=${token}`) | ||
expect(response.status).toBe(200) | ||
expect(response.body.message).toBe('User verified successfully.') | ||
.get(`/api/v1/users/verify-user?token=${token}`) | ||
expect(response.status).toBe(302); | ||
expect(response.headers.location).toBe(`${process.env.FE_URL}/verify-user`); | ||
|
||
},60000) | ||
|
||
test("should login an Admin", async () =>{ | ||
|
@@ -229,9 +231,9 @@ describe("Testing user Routes", () => { | |
const token = generateVerificationToken(dummySeller.email, 60); | ||
const response = await request(app) | ||
.get(`/api/v1/users/verify-user?token=${token}`) | ||
expect(response.status).toBe(200) | ||
expect(response.body.message).toBe('User verified successfully.') | ||
},60000) | ||
expect(response.status).toBe(302); | ||
expect(response.headers.location).toBe(`${process.env.FE_URL}/verify-user`); | ||
},60000) | ||
|
||
test("should return 200 when all roles are fetched", async () => { | ||
const response = await request(app) | ||
|
@@ -591,9 +593,10 @@ describe("Verifying user account",()=>{ | |
await User.create(userData) | ||
const token = generateVerificationToken(userData.email, 60); | ||
const response = await request(app) | ||
.get(`/api/v1/users/verify-user?token=${token}`) | ||
expect(response.status).toBe(200) | ||
expect(response.body.message).toBe('User verified successfully.') | ||
.get(`/api/v1/users/verify-user?token=${token}`) | ||
expect(response.status).toBe(302); | ||
expect(response.headers.location).toBe(`${process.env.FE_URL}/verify-user`); | ||
|
||
},60000) | ||
|
||
it("It should send a verification link.",async()=>{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters