Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pokemon-filter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MAHDIR Safaa
pokemon-filter
Merge requests
!4
Tache4
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Tache4
tache3
into
main
Overview
0
Commits
2
Pipelines
0
Changes
6
Merged
MAHDIR Safaa
requested to merge
tache3
into
main
2 months ago
Overview
0
Commits
2
Pipelines
0
Changes
6
Expand
Implement
#4 (closed)
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
2096ba2e
2 commits,
2 months ago
6 files
+
150
−
52
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
filter.test.js
0 → 100644
+
32
−
0
Options
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