Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NolanTrem committed Nov 5, 2024
1 parent ae97861 commit eb40155
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
20 changes: 20 additions & 0 deletions js/sdk/__tests__/r2rClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,26 @@ describe("R2RClient", () => {
expect((client as any).refreshToken).toBe("refresh-token");
});

test("verifyEmail should send POST request to /verify_email with correct data", async () => {
const mockResponse = { success: true };
mockAxiosInstance.request.mockResolvedValue({ data: mockResponse });

const email = "test@example.com";
const verification_code = "123456";
const result = await client.verifyEmail(email, verification_code);

expect(result).toEqual(mockResponse);
expect(mockAxiosInstance.request).toHaveBeenCalledWith({
method: "POST",
url: "verify_email",
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 });
Expand Down
8 changes: 7 additions & 1 deletion js/sdk/__tests__/r2rClientIntegrationSuperUser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let newCollectionId: string;
* X updateUser
* - refreshAccessToken
* X changePassword
* X requestPasswordReset
* - requestPasswordReset
* X confirmPasswordReset
* X deleteUser
* Ingestion:
Expand Down Expand Up @@ -241,6 +241,12 @@ describe("r2rClient Integration Tests", () => {
await expect(client.refreshAccessToken()).resolves.not.toThrow();
});

test("Request password reset", async () => {
await expect(
client.requestPasswordReset("admin@example.com"),
).resolves.not.toThrow();
});

test("Get analytics", async () => {
const filterCriteria: Record<string, any> | string = {
search_latencies: "search_latency",
Expand Down

0 comments on commit eb40155

Please sign in to comment.