Skip to content
Snippets Groups Projects

Tache4

Merged MAHDIR Safaa requested to merge tache3 into main
6 files
+ 150
52
Compare changes
  • Side-by-side
  • Inline
Files
6
filter.test.js 0 → 100644
+ 32
0
const { filterByWeight, filterByHeight } = require('./script.js')
test('filtre les pokémons dont le poids est supérieur à 3kg', () => {
const pokemons = [
{ name: 'Bulbasaur', weight: 6.9, height: 0.7 },
{ name: 'ivysaur', weight: 13, height: 1 },
{ name: 'venusaur', weight: 100, height: 2 },
{ name: 'Charmander', weight: 2, height: 0.6 },
];
const result = filterByWeight(pokemons);
expect(result).toEqual([
{ name: 'Bulbasaur', weight: 6.9, height: 0.7 },
{ name: 'ivysaur', weight: 13, height: 1 },
{ name: 'venusaur', weight: 100, height: 2 },
]);
});
test('filtre les pokémons dont la taille est inférieure à 1m', () => {
const pokemons = [
{ name: 'Bulbasaur', weight: 6.9, height: 0.7 },
{ name: 'ivysaur', weight: 13, height: 1 },
{ name: 'venusaur', weight: 100, height: 2 },
{ name: 'Charmander', weight: 2, height: 0.6 },
];
const result = filterByHeight(pokemons);
expect(result).toEqual([
{ name: 'Bulbasaur', weight: 6.9, height: 0.7 },
{ name: 'Charmander', weight: 2, height: 0.6 },
]);
});
\ No newline at end of file
Loading