Skip to content

Commit

Permalink
Merge branch 'main' into fix/move-modules
Browse files Browse the repository at this point in the history
  • Loading branch information
fjsj committed Jun 17, 2024
2 parents 0f485da + 3f2663b commit dcb8dcb
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions frontend/tests/useAssistant.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,17 @@ describe("useAssistant", () => {

describe("fetchAssistant", () => {
it("should fetch assistant and update state correctly", async () => {
const mockAssistants = [
{ id: 'weather_assistant', name: "Assistant 1" },
{ id: 'movies_assistant', name: "Assistant 2" },
];
const mockAssistant = { id: 'weather_assistant', name: "Assistant 1" };
(djangoAiAssistantGetAssistant as jest.Mock).mockResolvedValue(
mockAssistants
mockAssistant
);

const { result } = renderHook(() => useAssistant({ assistantId: 'weather_assistant' }));

expect(result.current.assistant).toBeNull();
expect(result.current.loadingFetchAssistant).toBe(false);

await act(async () => {
await result.current.fetchAssistant();
});

expect(result.current.assistant).toEqual(mockAssistants);
expect(result.current.assistant).toEqual(mockAssistant);
expect(result.current.loadingFetchAssistant).toBe(false);
});

Expand Down

0 comments on commit dcb8dcb

Please sign in to comment.