forked from invertase/react-native-firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiosPlugin.test.ts
More file actions
73 lines (57 loc) · 2.53 KB
/
Copy pathiosPlugin.test.ts
File metadata and controls
73 lines (57 loc) · 2.53 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { describe, expect, it } from '@jest/globals';
import {
setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion,
setAnalyticsPodfileWithoutAdIdSupport,
} from '../src/ios/podfile';
const podfileFixture = `platform :ios, '15.0'
prepare_react_native_project!
target 'ReactNativeFirebaseDemo' do
end
`;
describe('Analytics Config Plugin iOS Tests', function () {
it('adds the Podfile flag when withoutAdIdSupport is enabled', function () {
const result = setAnalyticsPodfileWithoutAdIdSupport(podfileFixture, true);
expect(result).toMatchSnapshot();
});
it('is idempotent when the Podfile flag is already present', function () {
const onceModified = setAnalyticsPodfileWithoutAdIdSupport(podfileFixture, true);
const twiceModified = setAnalyticsPodfileWithoutAdIdSupport(onceModified, true);
expect(twiceModified).toEqual(onceModified);
});
it('removes the generated Podfile flag when withoutAdIdSupport is disabled', function () {
const onceModified = setAnalyticsPodfileWithoutAdIdSupport(podfileFixture, true);
const restored = setAnalyticsPodfileWithoutAdIdSupport(onceModified, false);
expect(restored).toEqual(podfileFixture);
});
it('adds the Podfile flag when googleAppMeasurementOnDeviceConversion is enabled', function () {
const result = setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(podfileFixture, true);
expect(result).toMatchSnapshot();
});
it('is idempotent when the ODM Podfile flag is already present', function () {
const onceModified = setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(
podfileFixture,
true,
);
const twiceModified = setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(
onceModified,
true,
);
expect(twiceModified).toEqual(onceModified);
});
it('removes the generated Podfile flag when googleAppMeasurementOnDeviceConversion is disabled', function () {
const onceModified = setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(
podfileFixture,
true,
);
const restored = setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(onceModified, false);
expect(restored).toEqual(podfileFixture);
});
it('adds both iOS Podfile flags when both analytics options are enabled', function () {
const withWithoutAdIdSupport = setAnalyticsPodfileWithoutAdIdSupport(podfileFixture, true);
const result = setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(
withWithoutAdIdSupport,
true,
);
expect(result).toMatchSnapshot();
});
});