File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
packages/sprinkle-account/app/assets/tests/stores Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,14 @@ const form: LoginForm = {
2727 password : 'password'
2828}
2929
30+ // Mock useTranslator load function
31+ const loadTranslator = vi . fn ( )
32+ vi . mock ( '@userfrosting/sprinkle-core/stores' , ( ) => ( {
33+ useTranslator : ( ) => ( {
34+ load : loadTranslator
35+ } )
36+ } ) )
37+
3038describe ( 'authStore' , ( ) => {
3139 beforeEach ( ( ) => {
3240 setActivePinia ( createPinia ( ) )
@@ -67,6 +75,7 @@ describe('authStore', () => {
6775 expect ( axios . post ) . toHaveBeenCalledWith ( '/account/login' , form )
6876 expect ( result ) . toStrictEqual ( testUser )
6977 expect ( authStore . user ) . toStrictEqual ( testUser )
78+ expect ( loadTranslator ) . toHaveBeenCalled ( )
7079 } )
7180
7281 test ( 'should throw an error when login fails' , async ( ) => {
@@ -141,6 +150,7 @@ describe('authStore', () => {
141150 // Assert
142151 expect ( axios . get ) . toHaveBeenCalledWith ( '/account/logout' )
143152 expect ( authStore . user ) . toBeNull ( )
153+ expect ( loadTranslator ) . toHaveBeenCalled ( )
144154 } )
145155
146156 test ( 'should throw an error when logout fails' , async ( ) => {
You can’t perform that action at this time.
0 commit comments