Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created September 25, 2023 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YonatanKra/a8e40982b86424c06f93de19064c0df0 to your computer and use it in GitHub Desktop.
Save YonatanKra/a8e40982b86424c06f93de19064c0df0 to your computer and use it in GitHub Desktop.
Tauri-demo: logout
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);
});
});
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