Ajout du fichier de test ScoreAndVote.spec.ts et de son premier test.
Showing
2 changed files
with
22 additions
and
0 deletions
test/components/ScoreAndVote.spec.ts
0 → 100644
1 | +//#region --Import--. | ||
2 | +import { describe, expect, it } from "vitest"; | ||
3 | +import { mount } from "@vue/test-utils"; | ||
4 | +import ScoreAndVote from "../../components/details/ScoreAndVote.vue"; | ||
5 | +//#endregion | ||
6 | + | ||
7 | +describe("ScoreAndVote", () => { | ||
8 | + it("affiche correctement le score", () => { | ||
9 | + // Monter le composant avec ses props. | ||
10 | + const wrapper = mount(ScoreAndVote, { | ||
11 | + props: { | ||
12 | + score: 7, | ||
13 | + nbVote: 100, | ||
14 | + }, | ||
15 | + }); | ||
16 | + // Trouver l'élément qui contient le score. | ||
17 | + const scoreElement = wrapper.find(".bg-primary"); | ||
18 | + // Vérifier que le score est affiché correctement. | ||
19 | + expect(scoreElement.text()).contain("7"); | ||
20 | + }); | ||
21 | +}); |
-
Please register or login to post a comment