-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eas-cli][eas-json] add updates.channel to build metadata (#461)
- Loading branch information
jkh
authored
Jun 21, 2021
1 parent
fff7aac
commit be6a7f5
Showing
15 changed files
with
366 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
packages/eas-cli/src/build/android/__tests__/UpdatesModule-test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import fs from 'fs-extra'; | ||
import { vol } from 'memfs'; | ||
import os from 'os'; | ||
|
||
import { readChannelSafelyAsync } from '../UpdatesModule'; | ||
|
||
jest.mock('fs'); | ||
|
||
afterAll(() => { | ||
// do not remove the following line | ||
// this fixes a weird error with tempy in @expo/image-utils | ||
fs.removeSync(os.tmpdir()); | ||
}); | ||
|
||
beforeEach(() => { | ||
vol.reset(); | ||
// do not remove the following line | ||
// this fixes a weird error with tempy in @expo/image-utils | ||
fs.mkdirpSync(os.tmpdir()); | ||
}); | ||
|
||
const testChannel = 'test-channel'; | ||
describe(readChannelSafelyAsync, () => { | ||
it('retrieves the channel when it is defined natively', async () => { | ||
vol.fromJSON( | ||
{ | ||
'./android/app/src/main/AndroidManifest.xml': AndroidManifestWithChannel, | ||
}, | ||
'/expo-project' | ||
); | ||
const channel = await readChannelSafelyAsync('/expo-project'); | ||
expect(channel).toBe(testChannel); | ||
}); | ||
it('returns null if the channel is not defined natively', async () => { | ||
vol.fromJSON( | ||
{ | ||
'./android/app/src/main/AndroidManifest.xml': AndroidManifestNoChannel, | ||
}, | ||
'/expo-project' | ||
); | ||
const channel = await readChannelSafelyAsync('/expo-project'); | ||
expect(channel).toBeNull(); | ||
}); | ||
}); | ||
|
||
const AndroidManifestWithChannel = ` | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.expo.mycoolapp"> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<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"> | ||
<meta-data android:name="expo.modules.updates.UPDATES_CONFIGURATION_REQUEST_HEADERS_KEY" android:value='{"expo-channel-name":"${testChannel}"}'/> | ||
<activity | ||
android:name=".MainActivity" | ||
android:launchMode="singleTask" | ||
android:label="@string/app_name" | ||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" | ||
android:windowSoftInputMode="adjustResize"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> | ||
</application> | ||
</manifest> | ||
`; | ||
const AndroidManifestNoChannel = ` | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.expo.mycoolapp"> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<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"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:launchMode="singleTask" | ||
android:label="@string/app_name" | ||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize" | ||
android:windowSoftInputMode="adjustResize"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> | ||
</application> | ||
</manifest> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.