-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(settlement): fix failing test cases🧪
- Loading branch information
1 parent
a24145f
commit 13f8472
Showing
1 changed file
with
30 additions
and
19 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 |
---|---|---|
|
@@ -17,8 +17,8 @@ const settlementsClient = testClient(createApp().route("/", settlementsRouter)); | |
|
||
describe("settlements", () => { | ||
let userSessionToken = ""; | ||
let adminSessionToken = ""; | ||
const settlementId = ""; | ||
// let adminSessionToken = ""; | ||
const settlementId = "non-existent-id-thirty-two-character"; | ||
|
||
beforeAll(async () => { | ||
const testUser = await createTestUser({ | ||
|
@@ -30,30 +30,39 @@ describe("settlements", () => { | |
|
||
userSessionToken = testUser.session; | ||
|
||
const adminUser = await createTestUser({ | ||
email: "[email protected]", | ||
password: "12345678", | ||
role: AuthRoles.ADMIN, | ||
fullName: "Test Admin", | ||
}); | ||
// const adminUser = await createTestUser({ | ||
// email: "[email protected]", | ||
// password: "12345678", | ||
// role: AuthRoles.ADMIN, | ||
// fullName: "Test Admin", | ||
// }); | ||
|
||
adminSessionToken = adminUser.session; | ||
// adminSessionToken = adminUser.session; | ||
}); | ||
|
||
describe("PATCH /settlements/:settlementId", () => { | ||
it("should return 404 when settlement with given id not found", async () => { | ||
const response = await settlementsClient.settlements[ | ||
":settlementId" | ||
].$patch({ | ||
param: { | ||
settlementId, | ||
].$patch( | ||
{ | ||
param: { | ||
settlementId, | ||
}, | ||
json: { | ||
amount: 100, | ||
receiverId: | ||
"123456789123456789123456789123456789123456789123456789123121", | ||
senderId: | ||
"123456789123456789123456789123456789123456789123456789123122", | ||
}, | ||
}, | ||
json: { | ||
amount: 100, | ||
receiverId: "123", | ||
senderId: "456", | ||
{ | ||
headers: { | ||
session: userSessionToken, | ||
}, | ||
}, | ||
}); | ||
); | ||
|
||
expect(response.status).toBe(404); | ||
|
||
|
@@ -74,8 +83,10 @@ describe("settlements", () => { | |
}, | ||
json: { | ||
amount: 100, | ||
receiverId: "123", | ||
senderId: "456", | ||
receiverId: | ||
"123456789123456789123456789123456789123456789123456789123121", | ||
senderId: | ||
"123456789123456789123456789123456789123456789123456789123122", | ||
}, | ||
}); | ||
|
||
|