Skip to content

Commit e980360

Browse files
committed
unit test to verify customData upon user-disabled error.
1 parent 94abdc5 commit e980360

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

packages/auth/src/api/authentication/idp.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,34 @@ describe('api/authentication/signInWithIdp', () => {
8787
);
8888
expect(mock.calls[0].request).to.eql(request);
8989
});
90+
it('should handle user disabled errors and propagate email info', async () => {
91+
const response = {
92+
93+
error: {
94+
code: 400,
95+
message: ServerError.USER_DISABLED,
96+
errors: [
97+
{
98+
message: ServerError.USER_DISABLED
99+
}
100+
]
101+
}
102+
};
103+
104+
const mock = mockEndpoint(
105+
Endpoint.SIGN_IN_WITH_IDP,
106+
response,
107+
400
108+
);
109+
110+
await expect(signInWithIdp(auth, request))
111+
.to.be.rejectedWith(FirebaseError, 'auth/user-disabled')
112+
.eventually.with.deep.property('customData', {
113+
appName: 'test-app',
114+
_tokenResponse: response,
115+
116+
});
117+
118+
expect(mock.calls[0].request).to.eql(request);
119+
});
90120
});

0 commit comments

Comments
 (0)