@@ -6,6 +6,7 @@ import { createMockLogger } from '../../__tests__/utils/logger';
66import { BuildContext } from '../../context' ;
77import { Datadog } from '../../datadog' ;
88import { restoreCredentials } from '../../android/credentials' ;
9+ import { uploadEmbeddedBundleAsync } from '../../utils/expoUpdatesEmbedded' ;
910import androidBuilder from '../android' ;
1011import { runBuilderWithHooksAsync } from '../common' ;
1112import {
@@ -57,6 +58,9 @@ jest.mock('../../utils/expoUpdates', () => ({
5758 configureExpoUpdatesIfInstalledAsync : jest . fn ( ) ,
5859 resolveRuntimeVersionForExpoUpdatesIfConfiguredAsync : jest . fn ( async ( ) => null ) ,
5960} ) ) ;
61+ jest . mock ( '../../utils/expoUpdatesEmbedded' , ( ) => ( {
62+ uploadEmbeddedBundleAsync : jest . fn ( ) ,
63+ } ) ) ;
6064jest . mock ( '../../utils/hooks' , ( ) => ( {
6165 Hook : {
6266 POST_INSTALL : 'POST_INSTALL' ,
@@ -269,4 +273,37 @@ describe(androidBuilder, () => {
269273
270274 expect ( runBuilderWithHooksAsync ) . toHaveBeenCalledWith ( ctx , expect . any ( Function ) ) ;
271275 } ) ;
276+
277+ it ( 'runs the embedded bundle upload phase when EAS_UPDATE_EXPERIMENTAL_UPLOAD_EMBEDDED_BUNDLE is set' , async ( ) => {
278+ const ctx = new BuildContext ( createTestAndroidJob ( ) , {
279+ workingdir : '/workingdir' ,
280+ logBuffer : { getLogs : ( ) => [ ] , getPhaseLogs : ( ) => [ ] } ,
281+ logger : createMockLogger ( ) ,
282+ env : {
283+ __API_SERVER_URL : 'http://api.expo.test' ,
284+ EAS_UPDATE_EXPERIMENTAL_UPLOAD_EMBEDDED_BUNDLE : '1' ,
285+ } ,
286+ uploadArtifact : jest . fn ( ) ,
287+ } ) ;
288+
289+ await androidBuilder ( ctx ) ;
290+
291+ expect ( uploadEmbeddedBundleAsync ) . toHaveBeenCalledWith ( ctx ) ;
292+ } ) ;
293+
294+ it ( 'skips the embedded bundle upload phase when EAS_UPDATE_EXPERIMENTAL_UPLOAD_EMBEDDED_BUNDLE is not set' , async ( ) => {
295+ const ctx = new BuildContext ( createTestAndroidJob ( ) , {
296+ workingdir : '/workingdir' ,
297+ logBuffer : { getLogs : ( ) => [ ] , getPhaseLogs : ( ) => [ ] } ,
298+ logger : createMockLogger ( ) ,
299+ env : {
300+ __API_SERVER_URL : 'http://api.expo.test' ,
301+ } ,
302+ uploadArtifact : jest . fn ( ) ,
303+ } ) ;
304+
305+ await androidBuilder ( ctx ) ;
306+
307+ expect ( uploadEmbeddedBundleAsync ) . not . toHaveBeenCalled ( ) ;
308+ } ) ;
272309} ) ;
0 commit comments