Skip to content

Commit 742c6a0

Browse files
DoctorJohndylancom
authored andcommitted
test: expo config plugin with app.config.js/ts
1 parent 5901e83 commit 742c6a0

File tree

7 files changed

+361
-10
lines changed

7 files changed

+361
-10
lines changed

plugin/__tests__/__snapshots__/plugin.test.ts.snap

Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,88 @@ exports[`Expo Config Plugin Tests Should modify AndroidManifest.xml 1`] = `
4141
</manifest>"
4242
`;
4343
44+
exports[`Expo Config Plugin Tests Should modify AndroidManifest.xml 2`] = `
45+
"<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example" xmlns:tools="http://schemas.android.com/tools">
46+
<uses-permission android:name="android.permission.INTERNET"/>
47+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
48+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
49+
<uses-permission android:name="android.permission.VIBRATE"/>
50+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
51+
<queries>
52+
<intent>
53+
<action android:name="android.intent.action.VIEW"/>
54+
<category android:name="android.intent.category.BROWSABLE"/>
55+
<data android:scheme="https"/>
56+
</intent>
57+
</queries>
58+
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
59+
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="TestAppId" tools:replace="android:value"/>
60+
<meta-data android:name="com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT" android:value="true" tools:replace="android:value"/>
61+
<meta-data android:name="com.google.android.gms.ads.flag.OPTIMIZE_AD_LOADING" android:value="true" tools:replace="android:value"/>
62+
<meta-data android:name="com.google.android.gms.ads.flag.OPTIMIZE_INITIALIZATION" android:value="true" tools:replace="android:value"/>
63+
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
64+
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="47.0.0"/>
65+
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
66+
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
67+
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@anonymous/example"/>
68+
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true">
69+
<intent-filter>
70+
<action android:name="android.intent.action.MAIN"/>
71+
<category android:name="android.intent.category.LAUNCHER"/>
72+
</intent-filter>
73+
<intent-filter>
74+
<action android:name="android.intent.action.VIEW"/>
75+
<category android:name="android.intent.category.DEFAULT"/>
76+
<category android:name="android.intent.category.BROWSABLE"/>
77+
<data android:scheme="com.example"/>
78+
</intent-filter>
79+
</activity>
80+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
81+
</application>
82+
</manifest>"
83+
`;
84+
85+
exports[`Expo Config Plugin Tests Should modify AndroidManifest.xml 3`] = `
86+
"<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example" xmlns:tools="http://schemas.android.com/tools">
87+
<uses-permission android:name="android.permission.INTERNET"/>
88+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
89+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
90+
<uses-permission android:name="android.permission.VIBRATE"/>
91+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
92+
<queries>
93+
<intent>
94+
<action android:name="android.intent.action.VIEW"/>
95+
<category android:name="android.intent.category.BROWSABLE"/>
96+
<data android:scheme="https"/>
97+
</intent>
98+
</queries>
99+
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true">
100+
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="TestAppId" tools:replace="android:value"/>
101+
<meta-data android:name="com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT" android:value="true" tools:replace="android:value"/>
102+
<meta-data android:name="com.google.android.gms.ads.flag.OPTIMIZE_AD_LOADING" android:value="true" tools:replace="android:value"/>
103+
<meta-data android:name="com.google.android.gms.ads.flag.OPTIMIZE_INITIALIZATION" android:value="true" tools:replace="android:value"/>
104+
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
105+
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="47.0.0"/>
106+
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
107+
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
108+
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@anonymous/example"/>
109+
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true">
110+
<intent-filter>
111+
<action android:name="android.intent.action.MAIN"/>
112+
<category android:name="android.intent.category.LAUNCHER"/>
113+
</intent-filter>
114+
<intent-filter>
115+
<action android:name="android.intent.action.VIEW"/>
116+
<category android:name="android.intent.category.DEFAULT"/>
117+
<category android:name="android.intent.category.BROWSABLE"/>
118+
<data android:scheme="com.example"/>
119+
</intent-filter>
120+
</activity>
121+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
122+
</application>
123+
</manifest>"
124+
`;
125+
44126
exports[`Expo Config Plugin Tests Should modify Info.plist 1`] = `
45127
"<?xml version="1.0" encoding="UTF-8"?>
46128
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -138,3 +220,199 @@ exports[`Expo Config Plugin Tests Should modify Info.plist 1`] = `
138220
</dict>
139221
</plist>"
140222
`;
223+
224+
exports[`Expo Config Plugin Tests Should modify Info.plist 2`] = `
225+
"<?xml version="1.0" encoding="UTF-8"?>
226+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
227+
<plist version="1.0">
228+
<dict>
229+
<key>CFBundleDevelopmentRegion</key>
230+
<string>$(DEVELOPMENT_LANGUAGE)</string>
231+
<key>CFBundleDisplayName</key>
232+
<string>example</string>
233+
<key>CFBundleExecutable</key>
234+
<string>$(EXECUTABLE_NAME)</string>
235+
<key>CFBundleIdentifier</key>
236+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
237+
<key>CFBundleInfoDictionaryVersion</key>
238+
<string>6.0</string>
239+
<key>CFBundleName</key>
240+
<string>$(PRODUCT_NAME)</string>
241+
<key>CFBundlePackageType</key>
242+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
243+
<key>CFBundleShortVersionString</key>
244+
<string>1.0.0</string>
245+
<key>CFBundleSignature</key>
246+
<string>????</string>
247+
<key>CFBundleURLTypes</key>
248+
<array>
249+
<dict>
250+
<key>CFBundleURLSchemes</key>
251+
<array>
252+
<string>com.example</string>
253+
</array>
254+
</dict>
255+
</array>
256+
<key>CFBundleVersion</key>
257+
<string>1</string>
258+
<key>GADApplicationIdentifier</key>
259+
<string>TestIosId</string>
260+
<key>GADDelayAppMeasurementInit</key>
261+
<true/>
262+
<key>LSRequiresIPhoneOS</key>
263+
<true/>
264+
<key>NSAppTransportSecurity</key>
265+
<dict>
266+
<key>NSAllowsArbitraryLoads</key>
267+
<true/>
268+
<key>NSExceptionDomains</key>
269+
<dict>
270+
<key>localhost</key>
271+
<dict>
272+
<key>NSExceptionAllowsInsecureHTTPLoads</key>
273+
<true/>
274+
</dict>
275+
</dict>
276+
</dict>
277+
<key>NSUserTrackingUsageDescription</key>
278+
<string>TestUserTrackingUsageDescription</string>
279+
<key>SKAdNetworkItems</key>
280+
<array>
281+
<dict>
282+
<key>SKAdNetworkIdentifier</key>
283+
<string>TestSkAdNetworkItem1</string>
284+
</dict>
285+
<dict>
286+
<key>SKAdNetworkIdentifier</key>
287+
<string>TestSkAdNetworkItem2</string>
288+
</dict>
289+
</array>
290+
<key>UILaunchStoryboardName</key>
291+
<string>SplashScreen</string>
292+
<key>UIRequiredDeviceCapabilities</key>
293+
<array>
294+
<string>armv7</string>
295+
</array>
296+
<key>UIRequiresFullScreen</key>
297+
<false/>
298+
<key>UIStatusBarStyle</key>
299+
<string>UIStatusBarStyleDefault</string>
300+
<key>UISupportedInterfaceOrientations</key>
301+
<array>
302+
<string>UIInterfaceOrientationPortrait</string>
303+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
304+
<string>UIInterfaceOrientationLandscapeLeft</string>
305+
<string>UIInterfaceOrientationLandscapeRight</string>
306+
</array>
307+
<key>UISupportedInterfaceOrientations~ipad</key>
308+
<array>
309+
<string>UIInterfaceOrientationPortrait</string>
310+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
311+
<string>UIInterfaceOrientationLandscapeLeft</string>
312+
<string>UIInterfaceOrientationLandscapeRight</string>
313+
</array>
314+
<key>UIUserInterfaceStyle</key>
315+
<string>Light</string>
316+
<key>UIViewControllerBasedStatusBarAppearance</key>
317+
<false/>
318+
</dict>
319+
</plist>"
320+
`;
321+
322+
exports[`Expo Config Plugin Tests Should modify Info.plist 3`] = `
323+
"<?xml version="1.0" encoding="UTF-8"?>
324+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
325+
<plist version="1.0">
326+
<dict>
327+
<key>CFBundleDevelopmentRegion</key>
328+
<string>$(DEVELOPMENT_LANGUAGE)</string>
329+
<key>CFBundleDisplayName</key>
330+
<string>example</string>
331+
<key>CFBundleExecutable</key>
332+
<string>$(EXECUTABLE_NAME)</string>
333+
<key>CFBundleIdentifier</key>
334+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
335+
<key>CFBundleInfoDictionaryVersion</key>
336+
<string>6.0</string>
337+
<key>CFBundleName</key>
338+
<string>$(PRODUCT_NAME)</string>
339+
<key>CFBundlePackageType</key>
340+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
341+
<key>CFBundleShortVersionString</key>
342+
<string>1.0.0</string>
343+
<key>CFBundleSignature</key>
344+
<string>????</string>
345+
<key>CFBundleURLTypes</key>
346+
<array>
347+
<dict>
348+
<key>CFBundleURLSchemes</key>
349+
<array>
350+
<string>com.example</string>
351+
</array>
352+
</dict>
353+
</array>
354+
<key>CFBundleVersion</key>
355+
<string>1</string>
356+
<key>GADApplicationIdentifier</key>
357+
<string>TestIosId</string>
358+
<key>GADDelayAppMeasurementInit</key>
359+
<true/>
360+
<key>LSRequiresIPhoneOS</key>
361+
<true/>
362+
<key>NSAppTransportSecurity</key>
363+
<dict>
364+
<key>NSAllowsArbitraryLoads</key>
365+
<true/>
366+
<key>NSExceptionDomains</key>
367+
<dict>
368+
<key>localhost</key>
369+
<dict>
370+
<key>NSExceptionAllowsInsecureHTTPLoads</key>
371+
<true/>
372+
</dict>
373+
</dict>
374+
</dict>
375+
<key>NSUserTrackingUsageDescription</key>
376+
<string>TestUserTrackingUsageDescription</string>
377+
<key>SKAdNetworkItems</key>
378+
<array>
379+
<dict>
380+
<key>SKAdNetworkIdentifier</key>
381+
<string>TestSkAdNetworkItem1</string>
382+
</dict>
383+
<dict>
384+
<key>SKAdNetworkIdentifier</key>
385+
<string>TestSkAdNetworkItem2</string>
386+
</dict>
387+
</array>
388+
<key>UILaunchStoryboardName</key>
389+
<string>SplashScreen</string>
390+
<key>UIRequiredDeviceCapabilities</key>
391+
<array>
392+
<string>armv7</string>
393+
</array>
394+
<key>UIRequiresFullScreen</key>
395+
<false/>
396+
<key>UIStatusBarStyle</key>
397+
<string>UIStatusBarStyleDefault</string>
398+
<key>UISupportedInterfaceOrientations</key>
399+
<array>
400+
<string>UIInterfaceOrientationPortrait</string>
401+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
402+
<string>UIInterfaceOrientationLandscapeLeft</string>
403+
<string>UIInterfaceOrientationLandscapeRight</string>
404+
</array>
405+
<key>UISupportedInterfaceOrientations~ipad</key>
406+
<array>
407+
<string>UIInterfaceOrientationPortrait</string>
408+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
409+
<string>UIInterfaceOrientationLandscapeLeft</string>
410+
<string>UIInterfaceOrientationLandscapeRight</string>
411+
</array>
412+
<key>UIUserInterfaceStyle</key>
413+
<string>Light</string>
414+
<key>UIViewControllerBasedStatusBarAppearance</key>
415+
<false/>
416+
</dict>
417+
</plist>"
418+
`;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
module.exports = {
2+
name: 'example',
3+
slug: 'example',
4+
android: {
5+
package: 'com.example',
6+
},
7+
ios: {
8+
bundleIdentifier: 'com.example',
9+
},
10+
plugins: [
11+
[
12+
'../../build',
13+
{
14+
androidAppId: 'TestAppId',
15+
iosAppId: 'TestIosId',
16+
delayAppMeasurementInit: true,
17+
optimizeInitialization: true,
18+
optimizeAdLoading: true,
19+
skAdNetworkItems: ['TestSkAdNetworkItem1', 'TestSkAdNetworkItem2'],
20+
userTrackingUsageDescription: 'TestUserTrackingUsageDescription',
21+
},
22+
],
23+
],
24+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export default {
2+
name: 'example',
3+
slug: 'example',
4+
android: {
5+
package: 'com.example',
6+
},
7+
ios: {
8+
bundleIdentifier: 'com.example',
9+
},
10+
plugins: [
11+
[
12+
'../../build',
13+
{
14+
androidAppId: 'TestAppId',
15+
iosAppId: 'TestIosId',
16+
delayAppMeasurementInit: true,
17+
optimizeInitialization: true,
18+
optimizeAdLoading: true,
19+
skAdNetworkItems: ['TestSkAdNetworkItem1', 'TestSkAdNetworkItem2'],
20+
userTrackingUsageDescription: 'TestUserTrackingUsageDescription',
21+
},
22+
],
23+
],
24+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
name: 'example',
3+
slug: 'example',
4+
android: {
5+
package: 'com.example',
6+
},
7+
ios: {
8+
bundleIdentifier: 'com.example',
9+
},
10+
plugins: [['../../build']],
11+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
name: 'example',
3+
slug: 'example',
4+
android: {
5+
package: 'com.example',
6+
},
7+
ios: {
8+
bundleIdentifier: 'com.example',
9+
},
10+
plugins: [['../../build']],
11+
};

0 commit comments

Comments
 (0)