Skip to content

Commit

Permalink
Add test for remove highlight on tour close
Browse files Browse the repository at this point in the history
  • Loading branch information
Imran92 authored and Imran Hossain committed Mar 20, 2024
1 parent 475f2c8 commit 106c6a7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions assets/admin/tour/components/sensei-tour-kit/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import SenseiTourKit from './index';
import getTourSteps from '../../course-tour/steps';
import { removeHighlightClasses } from '../../helper';
/**
* External dependencies
*/
Expand All @@ -26,6 +27,8 @@ jest.mock( '@wordpress/data', () => ( {
useSelect: jest.fn().mockImplementation( () => ( {} ) ),
} ) );

jest.mock( '../../helper' );

const mockFunction = jest.fn();

describe( 'SenseiTourKit', () => {
Expand Down Expand Up @@ -105,6 +108,9 @@ describe( 'SenseiTourKit', () => {

test( 'should close the tour when closeHandler is called', () => {
const setTourShowStatus = jest.fn();
const removeHighlight = jest.fn();

removeHighlightClasses.mockImplementation( removeHighlight );

useDispatch.mockReturnValue( { setTourShowStatus } );

Expand All @@ -119,6 +125,7 @@ describe( 'SenseiTourKit', () => {
true,
'test-tour'
);
expect( removeHighlight ).toHaveBeenCalled();
} );

test( 'should call the event log function when step is viewed', () => {
Expand Down

0 comments on commit 106c6a7

Please sign in to comment.