Created
September 25, 2023 07:18
-
-
Save YonatanKra/a8e40982b86424c06f93de19064c0df0 to your computer and use it in GitHub Desktop.
Tauri-demo: logout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('logout', () => { | |
let firebaseAuth: any; | |
beforeEach(async () => { | |
firebaseAuth = await import('firebase/auth'); | |
}); | |
it('should call firebase signOut', async () => { | |
auth.logout(); | |
expect(firebaseAuth.signOut).toHaveBeenCalledWith(firebaseAuth.getAuth()); | |
}); | |
it('should emit `user-status-change` event', async () => { | |
const spy = spyOnUserStatusChangeEvent(auth); | |
await auth.logout(); | |
const eventCalls = spy.mock.calls.length; | |
expect(eventCalls).toBe(1); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async logout() { | |
await signOut(getAuth()); | |
this.dispatchEvent(new CustomEvent('user-status-change')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment