Modify pokedex.test.ts, clear up redundant code

develop
Jason Zhu 2023-04-12 23:54:12 +10:00
parent 8696392dce
commit 91ead7f64f
2 changed files with 65 additions and 63 deletions

View File

@ -5,14 +5,15 @@ import {
import { PokemonResponseData } from 'features/Pokedex/types/api';
import pokemon3_Venusaur from 'features/Pokedex/__test__/pokemon3_Venusaur.json';
import pokemon4_Charmander from 'features/Pokedex/__test__/pokemon4_charmander.json';
import { AppDispatch, AppStore } from 'app/store';
import { configureStore, Store } from '@reduxjs/toolkit';
import { AppStore } from 'app/store';
import { configureStore } from '@reduxjs/toolkit';
import { pokedexSlice } from 'features/Pokedex/pokedexSlice';
import { pokedexApi } from 'features/Pokedex/pokedexApi';
import { listenerMiddleware } from 'app/listenerMiddleware';
let store: AppStore;
let dispatch: AppDispatch;
describe('pokedex Component', () => {
describe('filterPokemonByType works correctly', () => {
beforeEach(() => {
store = configureStore({
@ -80,3 +81,4 @@ describe('sortPokemonsByIdOrName works correctly', () => {
expect(sortedList).toEqual([pokemon4_Charmander, pokemon3_Venusaur]);
});
});
});

View File

@ -5,7 +5,7 @@ import region1 from 'features/Pokedex/__test__/responses/region1.json';
import pokemon1 from 'features/Pokedex/__test__/responses/pokemon1.json';
import { RegionListResponseData, TypeListResponseData } from '../types/api';
import { AppStore } from 'app/store';
import { listenerMiddleware } from '../../../app/listenerMiddleware';
import { listenerMiddleware } from 'app/listenerMiddleware';
let store: AppStore;
describe('pokedexApi', () => {