Add TODO for removing unnecessary endpoints

develop
Jason Zhu 2023-04-02 16:01:36 +10:00
parent a831e76275
commit 5fee30437b
3 changed files with 3 additions and 0 deletions

View File

@ -115,6 +115,7 @@ describe('pokedexApi', () => {
expect(pokemonListData?.previous).toBeUndefined();
});
// TODO: decide whether remove these test handlers, as logic of getting Pokemon List for a Region is no longer correct
test('query getRegionPokemonList for johto should return correct data in list', async () => {
await store.dispatch(
pokedexApi.endpoints.getRegionPokemonList.initiate('johto'),

View File

@ -66,6 +66,7 @@ export const pokedexApi = createApi({
getArea: builder.query<AreaResponseData, number | string>({
query: IdOrName => ({ url: `location-area/${IdOrName}` }),
}),
// TODO: decide whether remove this endpoint, as logic of getting PokemonList for a region is no longer correct
getRegionPokemonList: builder.query<PokemonListItem[], number | string>({
async queryFn(regionIdOrName, api) {
api.dispatch(setFetchingRegionPokemonList(true));

View File

@ -42,6 +42,7 @@ export const handlers = [
}),
// getRegionPokemonList
// TODO: decide whether remove these test handlers, as logic of getting Pokemon List for a Region is no longer correct
rest.get('https://pokeapi.co/api/v2/region/johto', (req, res, ctx) => {
return res(ctx.json(region_johto));
}),