Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Bruno Predot
/
tmdb_test
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Bruno Predot
2025-04-29 19:35:43 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a635cb1347832223c7ec3bf3f10535fad13d139b
a635cb13
1 parent
6d8253a4
Ajout des test sur le nombre de votes formatés et non formatés dans le fichier t…
…est ScoreAndVote.spec.ts.
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
test/components/ScoreAndVote.spec.ts
test/components/ScoreAndVote.spec.ts
View file @
a635cb1
...
...
@@ -56,7 +56,39 @@ describe("ScoreAndVote", () => {
},
});
// Trouver l'élément qui contient le paragraphe.
const
scoreElement
=
wrapper
.
find
(
"p"
);
expect
(
scoreElement
.
text
()).
toBe
(
"Note TMDB"
);
const
paragrapheElement
=
wrapper
.
find
(
"p"
);
expect
(
paragrapheElement
.
text
()).
toBe
(
"Note TMDB"
);
});
it
(
"affiche correctement le nombre de vote sans formatage si inférieur à 1000"
,
()
=>
{
// Monter le composant avec ses props.
const
wrapper
=
mount
(
ScoreAndVote
,
{
props
:
{
score
:
7.654
,
nbVote
:
855
,
},
});
// Trouver l'élément qui contient le nombre de votes.
const
voteElement
=
wrapper
.
find
(
"div"
);
// Vérifier si la div contient le nombre.
expect
(
voteElement
.
text
()).
toContain
(
"855"
);
// Vérifier si le texte de la div correspond exactement.
expect
(
voteElement
.
text
()).
toBe
(
"855 votes"
);
});
it
(
"affiche correctement le nombre de vote formaté en 'k' si supérieur ou égal à 1000"
,
()
=>
{
// Monter le composant avec ses props.
const
wrapper
=
mount
(
ScoreAndVote
,
{
props
:
{
score
:
9
,
nbVote
:
1477
,
},
});
// Trouver l'élément qui contient le nombre de votes.
const
voteElement
=
wrapper
.
find
(
"div"
);
// Vérifier si la div contient le nombre.
expect
(
voteElement
.
text
()).
toContain
(
"1.5"
);
// Vérifier si le texte de la div correspond exactement.
expect
(
voteElement
.
text
()).
toBe
(
"1.5k votes"
);
});
});
...
...
Please
register
or
login
to post a comment