Skip to content

Commit b9f1fd3

Browse files
committed
Add tests for Users preserving auth reference equality
1 parent 5119ca4 commit b9f1fd3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/unit/user.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ describe('User', function() {
7373
});
7474
}).to.throw(User.msg_tokenAuthedInTheFuture);
7575
});
76+
77+
it('should keep reference to passed-in auth', () => {
78+
const user = new User(auth, {});
79+
auth.autoFlush(false);
80+
expect(user._auth.flushDelay).to.equal(false);
81+
});
7682
});
7783

7884
describe('#clone', function() {
@@ -84,6 +90,13 @@ describe('User', function() {
8490
u2.customClaims.claim1 = 'value2';
8591
expect(u1.customClaims).to.deep.equal(ogClaims);
8692
});
93+
94+
it('preserves reference to auth', () => {
95+
const u1 = new User(auth, {});
96+
const u2 = u1.clone();
97+
u1._auth.autoFlush(false);
98+
expect(u2._auth.flushDelay).to.equal(u1._auth.flushDelay);
99+
});
87100
});
88101

89102
describe('#delete', function() {

0 commit comments

Comments
 (0)