Skip to content

Commit ce8936e

Browse files
committed
Add delay to (negative) tests
1 parent 424d4b6 commit ce8936e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/auth-compat/src/auth.test.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ import * as platform from './platform';
2727

2828
use(sinonChai);
2929

30+
function delay(ms: number): Promise<void> {
31+
return new Promise(resolve => setTimeout(resolve, ms));
32+
}
33+
3034
// For the most part, the auth methods just call straight through. Some parts
3135
// of the auth compat layer are more complicated: these tests cover those
3236
describe('auth compat', () => {
@@ -102,6 +106,7 @@ describe('auth compat', () => {
102106
);
103107
// eslint-disable-next-line @typescript-eslint/no-floating-promises
104108
await authCompat.signInWithRedirect(new exp.GoogleAuthProvider());
109+
await delay(50);
105110
expect(setItemSpy).not.to.have.been.calledWith(
106111
'firebase:persistence:api-key:undefined',
107112
'TEST'
@@ -133,7 +138,7 @@ describe('auth compat', () => {
133138
}
134139
});
135140

136-
it('does not die if sessionStorage errors', () => {
141+
it('does not die if sessionStorage errors', async () => {
137142
if (typeof self !== 'undefined') {
138143
sinon.stub(platform, '_getSelfWindow').returns({
139144
get sessionStorage(): Storage {
@@ -148,6 +153,7 @@ describe('auth compat', () => {
148153
providerStub.initialize.returns(underlyingAuth);
149154
new Auth(app, providerStub as unknown as Provider<'auth'>);
150155
// eslint-disable-next-line @typescript-eslint/no-floating-promises
156+
await delay(50);
151157
expect(providerStub.initialize).to.have.been.calledWith({
152158
options: {
153159
popupRedirectResolver: CompatPopupRedirectResolver,

0 commit comments

Comments
 (0)