-
Notifications
You must be signed in to change notification settings - Fork 132
Expand file tree
/
Copy pathwithGoogleSigninIos-test.ts
More file actions
42 lines (37 loc) · 1.26 KB
/
withGoogleSigninIos-test.ts
File metadata and controls
42 lines (37 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { MissingParamsException } from "../MissingParamsException";
import {
setupGoogleSigninIos,
withGoogleSigninIos,
} from "../withGoogleSigninIos";
function fakeExportedConfig(plist?: Record<string, any>): any {
return { ios: { infoPlist: plist } };
}
describe(withGoogleSigninIos, () => {
it(`add "iosClientId" and "iosUrlScheme" to Info.plist`, () => {
const config = setupGoogleSigninIos(fakeExportedConfig(), {
iosClientId: "iosClientId",
iosUrlScheme: "iosUrlScheme",
});
expect(config).toEqual(
fakeExportedConfig({
GIDClientID: "iosClientId",
CFBundleURLTypes: [{ CFBundleURLSchemes: ["iosUrlScheme"] }],
}),
);
});
it(`should throw error missing "iosClientId" param`, () => {
expect(() =>
setupGoogleSigninIos(fakeExportedConfig(), { iosUrlScheme: "xx" }),
).toThrow(MissingParamsException);
});
it(`should throw error missing "iosUrlScheme" param`, () => {
expect(() =>
setupGoogleSigninIos(fakeExportedConfig(), { iosClientId: "xx" }),
).toThrow(MissingParamsException);
});
it(`should not throw mission param error when android only`, () => {
expect(() => setupGoogleSigninIos({ android: {} } as any, {})).not.toThrow(
MissingParamsException,
);
});
});