File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ import LoginConfirmationComponent from "@/components/LoginConfirmationComponent.vue" ;
2+ import { describe , expect , test } from "vitest" ;
3+ import type { User } from "../../types" ;
4+ import { userStore } from "../../stores/userStore" ;
5+ import { createPinia , setActivePinia } from "pinia" ;
6+ import { mount } from "@vue/test-utils" ;
7+
8+ describe ( "Given LoginConfirmationComponent" , ( ) => {
9+ expect ( LoginConfirmationComponent ) . toBeTruthy ( ) ;
10+ setActivePinia ( createPinia ( ) ) ;
11+
12+ test ( "Should display welcome message with storaged user data" , ( ) => {
13+
14+ const store = userStore ( ) ;
15+
16+ const providedUser : User = {
17+ name : "valid_name" ,
18+ email : "valid_email" ,
19+ idToken : "valid_token" ,
20+ localId : "valid_localId" ,
21+ } ;
22+
23+ store . setUserAction ( providedUser ) ;
24+
25+ const wrapper = mount ( LoginConfirmationComponent ) ;
26+ const spanText = `${ wrapper . find ( "span" ) . text ( ) } ` ;
27+
28+ expect ( spanText ) . toEqual ( "Bem vindo, valid_email!" ) ;
29+ } ) ;
30+ } ) ;
You can’t perform that action at this time.
0 commit comments