-
Notifications
You must be signed in to change notification settings - Fork 132
Expand file tree
/
Copy pathwithGoogleSigninAndroid-test.ts
More file actions
34 lines (29 loc) · 1.03 KB
/
withGoogleSigninAndroid-test.ts
File metadata and controls
34 lines (29 loc) · 1.03 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
import { MissingParamsException } from "../MissingParamsException";
import {
setupGoogleSigninAndroid,
withGoogleSigninAndroid,
} from "../withGoogleSigninAndroid";
type XML = { $: { name: string }; _: string };
function fakeExportedConfig(string?: XML[]): any {
return { android: {}, modResults: { resources: { string } } };
}
describe(withGoogleSigninAndroid, () => {
it("add serverClientId to strings.xml", () => {
const config = setupGoogleSigninAndroid(fakeExportedConfig(), {
serverClientId: "xxx",
});
expect(config).toEqual(
fakeExportedConfig([{ $: { name: "server_client_id" }, _: "xxx" }]),
);
});
it(`should throw error missing "serverClientId" param`, () => {
expect(() =>
setupGoogleSigninAndroid(fakeExportedConfig(), { serverClientId: "" }),
).toThrow(MissingParamsException);
});
it(`should not throw mission param error when ios only`, () => {
expect(() => setupGoogleSigninAndroid({ ios: {} } as any, {})).not.toThrow(
MissingParamsException,
);
});
});