Fixed Filters.test.ts
This commit is contained in:
parent
3539b6febe
commit
1d58f41b5f
@ -1,12 +1,12 @@
|
|||||||
import {
|
import {
|
||||||
useGetRegionPokemons,
|
useGetRegionOptions,
|
||||||
createRegionPokemonListOptionElements,
|
createRegionPokemonListOptionElements,
|
||||||
} from './Filters';
|
} from './Filters';
|
||||||
|
|
||||||
describe('Filters', () => {
|
describe('Filters', () => {
|
||||||
describe('test utility functions', () => {
|
describe('test utility functions', () => {
|
||||||
test('createOptionElements works correctly', () => {
|
test('createOptionElements works correctly', () => {
|
||||||
const { data } = useGetRegionPokemons();
|
const { data } = useGetRegionOptions();
|
||||||
const optionElements = createRegionPokemonListOptionElements(data);
|
const optionElements = createRegionPokemonListOptionElements(data);
|
||||||
expect(optionElements[0].props.children).toBe('Kanto (1-151)');
|
expect(optionElements[0].props.children).toBe('Kanto (1-151)');
|
||||||
expect(optionElements[1].props.children).toBe('Johto (152-251)');
|
expect(optionElements[1].props.children).toBe('Johto (152-251)');
|
||||||
|
@ -31,7 +31,7 @@ export const createRegionPokemonListOptionElements = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const useGetRegionOptions = () => {
|
export const useGetRegionOptions = () => {
|
||||||
const data: RegionPokemonRange[] = [
|
const data: RegionPokemonRange[] = [
|
||||||
{ region: 'kanto', startId: 1, endId: 151 },
|
{ region: 'kanto', startId: 1, endId: 151 },
|
||||||
{ region: 'johto', startId: 152, endId: 251 },
|
{ region: 'johto', startId: 152, endId: 251 },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user