Skip to content

Commit

Permalink
Revert "Set up custom navigation history for component test"
Browse files Browse the repository at this point in the history
This reverts commit 8fe1c39.

The test setup was incorrect
  • Loading branch information
sferra committed Mar 21, 2024
1 parent 8fe1c39 commit d79a6bb
Showing 1 changed file with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ import { createMemoryHistory } from 'history';
import { store as electronStore } from '@nuclear/core';

import { buildElectronStoreState, buildStoreState } from '../../../test/storeBuilders';
import {
AnyProps,
configureMockStore,
setupI18Next,
TestRouterProvider,
TestStoreProvider
} from '../../../test/testUtils';
import { AnyProps, configureMockStore, setupI18Next, TestRouterProvider, TestStoreProvider } from '../../../test/testUtils';
import MainContentContainer from '../MainContentContainer';
import { onReorder } from '.';

Expand Down Expand Up @@ -191,13 +185,7 @@ describe('Playlist view container', () => {
});

it('should delete a single track from the playlist', async () => {
const { component, history, store } = mountComponent(
undefined,
[
'/playlist/test-playlist-id',
'/previous-location'
]
);
const { component, store } = mountComponent();
await waitFor(() => component.getAllByTestId('delete-button')[0].click());

const state = store.getState();
Expand All @@ -208,9 +196,6 @@ describe('Playlist view container', () => {
name: 'test track 22'
})
]);
// FIXME: the expectations below don't work because the history instance is only the initial state, and not the modified state
expect(history.length).toBe(1);
expect(history.location).toBe('/previous-location');
});

it('should delete a single track from the playlist when there are its duplicates', async () => {
Expand Down Expand Up @@ -257,7 +242,7 @@ describe('Playlist view container', () => {
]);
});

const mountComponent = (initialStore?: AnyProps, initialHistory?: string[], initStore = true) => {
const mountComponent = (initialStore?: AnyProps, initStore = true) => {
const initialState = initialStore ||
buildStoreState()
.withPlugins()
Expand All @@ -272,7 +257,7 @@ describe('Playlist view container', () => {
});

const history = createMemoryHistory({
initialEntries: initialHistory || ['/playlist/test-playlist-id']
initialEntries: ['/playlist/test-playlist-id']
});

const store = configureMockStore(initialState);
Expand Down

0 comments on commit d79a6bb

Please sign in to comment.