Modify pokedex.test.ts, clear up redundant code
parent
8696392dce
commit
91ead7f64f
|
@ -5,15 +5,16 @@ 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('filterPokemonByType works correctly', () => {
|
||||
|
||||
describe('pokedex Component', () => {
|
||||
describe('filterPokemonByType works correctly', () => {
|
||||
beforeEach(() => {
|
||||
store = configureStore({
|
||||
reducer: {
|
||||
|
@ -47,9 +48,9 @@ describe('filterPokemonByType works correctly', () => {
|
|||
);
|
||||
expect(allPokemonAreOfTypeFire).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('sortPokemonsByIdOrName works correctly', () => {
|
||||
describe('sortPokemonsByIdOrName works correctly', () => {
|
||||
beforeEach(() => {
|
||||
store = configureStore({
|
||||
reducer: {
|
||||
|
@ -79,4 +80,5 @@ describe('sortPokemonsByIdOrName works correctly', () => {
|
|||
const sortedList = sortPokemonsByIdOrName(pokemonList, selectedSort);
|
||||
expect(sortedList).toEqual([pokemon4_Charmander, pokemon3_Venusaur]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
Loading…
Reference in New Issue