@@ -5,6 +5,7 @@ import { createTestAndroidJob } from '../../__tests__/utils/job';
55import { createMockLogger } from '../../__tests__/utils/logger' ;
66import { BuildContext } from '../../context' ;
77import { restoreCredentials } from '../../android/credentials' ;
8+ import { uploadEmbeddedBundleAsync } from '../../utils/expoUpdatesEmbedded' ;
89import androidBuilder from '../android' ;
910import { runBuilderWithHooksAsync } from '../common' ;
1011import {
@@ -56,6 +57,9 @@ jest.mock('../../utils/expoUpdates', () => ({
5657 configureExpoUpdatesIfInstalledAsync : jest . fn ( ) ,
5758 resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync : jest . fn ( async ( ) => null ) ,
5859} ) ) ;
60+ jest . mock ( '../../utils/expoUpdatesEmbedded' , ( ) => ( {
61+ uploadEmbeddedBundleAsync : jest . fn ( ) ,
62+ } ) ) ;
5963jest . mock ( '../../utils/hooks' , ( ) => ( {
6064 Hook : {
6165 POST_INSTALL : 'POST_INSTALL' ,
@@ -263,4 +267,37 @@ describe(androidBuilder, () => {
263267
264268 expect ( runBuilderWithHooksAsync ) . toHaveBeenCalledWith ( ctx , expect . any ( Function ) ) ;
265269 } ) ;
270+
271+ it ( 'runs the embedded bundle upload phase when EAS_UPDATE_EXPERIMENTAL_UPLOAD_EMBEDDED_BUNDLE is set' , async ( ) => {
272+ const ctx = new BuildContext ( createTestAndroidJob ( ) , {
273+ workingdir : '/workingdir' ,
274+ logBuffer : { getLogs : ( ) => [ ] , getPhaseLogs : ( ) => [ ] } ,
275+ logger : createMockLogger ( ) ,
276+ env : {
277+ __API_SERVER_URL : 'http://api.expo.test' ,
278+ EAS_UPDATE_EXPERIMENTAL_UPLOAD_EMBEDDED_BUNDLE : '1' ,
279+ } ,
280+ uploadArtifact : jest . fn ( ) ,
281+ } ) ;
282+
283+ await androidBuilder ( ctx ) ;
284+
285+ expect ( uploadEmbeddedBundleAsync ) . toHaveBeenCalledWith ( ctx ) ;
286+ } ) ;
287+
288+ it ( 'skips the embedded bundle upload phase when EAS_UPDATE_EXPERIMENTAL_UPLOAD_EMBEDDED_BUNDLE is not set' , async ( ) => {
289+ const ctx = new BuildContext ( createTestAndroidJob ( ) , {
290+ workingdir : '/workingdir' ,
291+ logBuffer : { getLogs : ( ) => [ ] , getPhaseLogs : ( ) => [ ] } ,
292+ logger : createMockLogger ( ) ,
293+ env : {
294+ __API_SERVER_URL : 'http://api.expo.test' ,
295+ } ,
296+ uploadArtifact : jest . fn ( ) ,
297+ } ) ;
298+
299+ await androidBuilder ( ctx ) ;
300+
301+ expect ( uploadEmbeddedBundleAsync ) . not . toHaveBeenCalled ( ) ;
302+ } ) ;
266303} ) ;
0 commit comments