Skip to content

Commit f7f0ea9

Browse files
committed
unit test to verify customData upon user-disabled error.
1 parent f696298 commit f7f0ea9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,35 @@ 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 mock = mockEndpoint(
92+
Endpoint.SIGN_IN_WITH_IDP,
93+
{
94+
95+
error: {
96+
code: 400,
97+
message: ServerError.USER_DISABLED,
98+
errors: [
99+
{
100+
message: ServerError.USER_DISABLED
101+
}
102+
]
103+
}
104+
},
105+
400
106+
);
107+
108+
let error: FirebaseError | null = null;
109+
try {
110+
await signInWithIdp(auth, request);
111+
} catch (e) {
112+
error = e;
113+
}
114+
expect(error!.customData!.email).to.eq("[email protected]");
115+
expect(error!.code).to.eq(
116+
'auth/user-disabled'
117+
);
118+
119+
expect(mock.calls[0].request).to.eql(request);
120+
});
90121
});

0 commit comments

Comments
 (0)