Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
ras1 committed Sep 25, 2023
1 parent 2fa51e5 commit 751b0bb
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { renderHook, act } from "@testing-library/react-hooks";
import axios from 'axios';
import AppConstants from '../../src/AppConstants';
import useVideoHook from "../../src/hooks/VideoHook";
import useVideoDataFetcher from "../../src/hooks/UseVideoDataFetcher";

jest.mock('axios');

Expand All @@ -15,7 +15,7 @@ const testVideos = [
}
];
const mockResponse = {
data: {
data: {
songs: testVideos
}
};
Expand All @@ -27,7 +27,7 @@ describe('useVideoHook', () => {

// call the hook using renderHook (it requires a component)
const initialPlaylistIds = [];
const { result, waitForNextUpdate } = renderHook(() => useVideoHook(initialPlaylistIds));
const { result, waitForNextUpdate } = renderHook(() => useVideoDataFetcher(initialPlaylistIds));
expect(axios.post).toHaveBeenCalledWith(AppConstants.APIEndpoints.SHUFFLE, { playlist_ids: initialPlaylistIds });

// expect hook state to have been initialized
Expand All @@ -53,7 +53,7 @@ describe('useVideoHook', () => {
dispatchFunction(updatedPlaylistIds);
})
expect(axios.post).toHaveBeenCalledWith(AppConstants.APIEndpoints.SHUFFLE, { playlist_ids: updatedPlaylistIds });

// expect hook state to have been initialized
hookResult = result.current[0];
expect(hookResult.videos).toEqual([]);
Expand Down

0 comments on commit 751b0bb

Please sign in to comment.