-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that additional middleware doesn't prevent proper error handli…
…ng (#1559) * Ensure that middleware does prevent proper error handling * Update tests
- Loading branch information
Showing
8 changed files
with
75 additions
and
39 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 |
---|---|---|
|
@@ -98,18 +98,39 @@ describe("R2RClient", () => { | |
const mockResponse = { success: true }; | ||
mockAxiosInstance.request.mockResolvedValue({ data: mockResponse }); | ||
|
||
const email = "[email protected]"; | ||
const verification_code = "123456"; | ||
const result = await client.verifyEmail(verification_code); | ||
const result = await client.verifyEmail(email, verification_code); | ||
|
||
expect(result).toEqual(mockResponse); | ||
expect(mockAxiosInstance.request).toHaveBeenCalledWith({ | ||
method: "POST", | ||
url: "verify_email", | ||
data: JSON.stringify({ verification_code }), | ||
data: JSON.stringify({ email, verification_code }), | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
responseType: "json", | ||
}); | ||
}); | ||
|
||
test("requestPasswordReset should send POST request to /request_password_reset with correct data", async () => { | ||
const mockResponse = { success: true }; | ||
mockAxiosInstance.request.mockResolvedValue({ data: mockResponse }); | ||
|
||
const email = "[email protected]"; | ||
const result = await client.requestPasswordReset(email); | ||
|
||
expect(result).toEqual(mockResponse); | ||
expect(mockAxiosInstance.request).toHaveBeenCalledWith({ | ||
method: "POST", | ||
url: "request_password_reset", | ||
data: '"[email protected]"', | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
responseType: "json", | ||
params: undefined, | ||
}); | ||
}); | ||
|
||
|
@@ -264,26 +285,6 @@ describe("R2RClient", () => { | |
}); | ||
}); | ||
|
||
test("requestPasswordReset should send POST request to /request_password_reset with correct data", async () => { | ||
const mockResponse = { success: true }; | ||
mockAxiosInstance.request.mockResolvedValue({ data: mockResponse }); | ||
|
||
const email = "[email protected]"; | ||
|
||
const result = await client.requestPasswordReset(email); | ||
|
||
expect(result).toEqual(mockResponse); | ||
expect(mockAxiosInstance.request).toHaveBeenCalledWith({ | ||
method: "POST", | ||
url: "request_password_reset", | ||
data: JSON.stringify({ email }), | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
responseType: "json", | ||
}); | ||
}); | ||
|
||
test("confirmPasswordReset should send POST request to /reset_password/{resetToken} with correct data", async () => { | ||
const mockResponse = { success: true }; | ||
mockAxiosInstance.request.mockResolvedValue({ data: mockResponse }); | ||
|
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 |
---|---|---|
|
@@ -26,7 +26,7 @@ let newCollectionId: string; | |
* X updateUser | ||
* - refreshAccessToken | ||
* X changePassword | ||
* X requestPasswordReset | ||
* - requestPasswordReset | ||
* X confirmPasswordReset | ||
* X deleteUser | ||
* Ingestion: | ||
|
@@ -241,6 +241,12 @@ describe("r2rClient Integration Tests", () => { | |
await expect(client.refreshAccessToken()).resolves.not.toThrow(); | ||
}); | ||
|
||
test("Request password reset", async () => { | ||
await expect( | ||
client.requestPasswordReset("[email protected]"), | ||
).resolves.not.toThrow(); | ||
}); | ||
|
||
test("Get analytics", async () => { | ||
const filterCriteria: Record<string, any> | string = { | ||
search_latencies: "search_latency", | ||
|
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ const baseUrl = "http://localhost:7272"; | |
* - updateUser | ||
* - refreshAccessToken | ||
* - changePassword | ||
* X requestPasswordReset | ||
* - requestPasswordReset | ||
* X confirmPasswordReset | ||
* - deleteUser | ||
* Ingestion: | ||
|
@@ -283,6 +283,12 @@ describe("r2rClient Integration Tests", () => { | |
).resolves.not.toThrow(); | ||
}); | ||
|
||
test("Request password reset", async () => { | ||
await expect( | ||
client.requestPasswordReset("[email protected]"), | ||
).resolves.not.toThrow(); | ||
}); | ||
|
||
test("Delete User", async () => { | ||
const currentUser = await client.user(); | ||
await expect( | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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