From da4904acd597662d6dfeb9ba396d176422ff30cf Mon Sep 17 00:00:00 2001 From: Marcos Date: Tue, 12 Nov 2024 16:13:28 -0300 Subject: [PATCH] chore: Added test for Xpert to use the bew hook --- src/widgets/Xpert.test.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/widgets/Xpert.test.jsx b/src/widgets/Xpert.test.jsx index 4fb133e3..ec6bef04 100644 --- a/src/widgets/Xpert.test.jsx +++ b/src/widgets/Xpert.test.jsx @@ -9,6 +9,7 @@ import Xpert from './Xpert'; import * as surveyMonkey from '../utils/surveyMonkey'; import { render, createRandomResponseForTesting } from '../utils/utils.test'; import { usePromptExperimentDecision } from '../experiments'; +import { useMessageHistory } from '../hooks'; jest.mock('@edx/frontend-platform/analytics'); jest.mock('@edx/frontend-platform/auth', () => ({ @@ -20,6 +21,8 @@ jest.mock('../experiments', () => ({ usePromptExperimentDecision: jest.fn(), })); +jest.mock('../hooks'); + const initialState = { learningAssistant: { currentMessage: '', @@ -76,6 +79,11 @@ test('initial load displays correct elements', async () => { // assert that UI elements in the sidebar are not in the DOM assertSidebarElementsNotInDOM(); }); +test('calls useMessageHistory() hook', () => { + render(, { preloadedState: initialState }); + + expect(useMessageHistory).toHaveBeenCalledWith(courseId); +}); test('clicking the call to action dismiss button removes the message', async () => { const user = userEvent.setup(); render(, { preloadedState: initialState });