mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-16 01:55:15 +03:00
7cc90ef258
* feat: add notification controller * feat: add polling logic on pending notifications * feat: refecth notifications on Feed
29 lines
786 B
TypeScript
29 lines
786 B
TypeScript
import { renderHook } from "@testing-library/react";
|
|
import { describe, expect, it, vi } from "vitest";
|
|
|
|
import { useNotificationApi } from "../useNotificationApi";
|
|
|
|
const axiosGetMock = vi.fn(() => ({}));
|
|
|
|
vi.mock("@/lib/hooks", () => ({
|
|
useAxios: () => ({
|
|
axiosInstance: {
|
|
get: axiosGetMock,
|
|
},
|
|
}),
|
|
}));
|
|
|
|
describe("useNotificationApi", () => {
|
|
it("should call getChatNotifications with the correct parameters", async () => {
|
|
const chatId = "test-chat-id";
|
|
const {
|
|
result: {
|
|
current: { getChatNotifications },
|
|
},
|
|
} = renderHook(() => useNotificationApi());
|
|
await getChatNotifications(chatId);
|
|
expect(axiosGetMock).toHaveBeenCalledTimes(1);
|
|
expect(axiosGetMock).toHaveBeenCalledWith(`/notifications/${chatId}`);
|
|
});
|
|
});
|