Skip to content

Commit 5119ca4

Browse files
committed
Factor auth state changed test setup
1 parent d1bdb43 commit 5119ca4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/unit/auth.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,12 @@ describe('Auth', function () {
316316
});
317317

318318
describe('#onAuthStateChanged', function () {
319-
it('is triggered when changeAuthState modifies data', function () {
319+
320+
beforeEach(() => {
320321
ref.onAuthStateChanged(spy);
322+
});
323+
324+
it('is triggered when changeAuthState modifies data', function () {
321325
ref.changeAuthState({
322326
uid: 'kato'
323327
});
@@ -328,7 +332,6 @@ describe('Auth', function () {
328332
});
329333

330334
it('is not be triggered if auth state does not change', function () {
331-
ref.onAuthStateChanged(spy);
332335
ref.changeAuthState({
333336
uid: 'kato'
334337
});
@@ -342,7 +345,6 @@ describe('Auth', function () {
342345
});
343346

344347
it('synchronously triggers the callback with the current auth data', function () {
345-
ref.onAuthStateChanged(spy);
346348
expect(spy).to.have.been.calledWith(null);
347349
});
348350
});

0 commit comments

Comments
 (0)