@@ -88,7 +88,7 @@ describe('uploadEmbeddedBundleAsync', () => {
8888 expect ( artifacts . findArtifacts ) . not . toHaveBeenCalled ( ) ;
8989 } ) ;
9090
91- it ( 'warns when no channel is configured' , async ( ) => {
91+ it ( 'warns when no channel is configured and does not look for the archive ' , async ( ) => {
9292 const ctx = makeCtx ( { platform : Platform . ANDROID } ) ;
9393
9494 await uploadEmbeddedBundleAsync ( ctx ) ;
@@ -97,6 +97,17 @@ describe('uploadEmbeddedBundleAsync', () => {
9797 'Skipping embedded bundle upload: no channel configured for this build profile.'
9898 ) ;
9999 expect ( ctx . markBuildPhaseHasWarnings ) . toHaveBeenCalled ( ) ;
100+ expect ( artifacts . findArtifacts ) . not . toHaveBeenCalled ( ) ;
101+ } ) ;
102+
103+ it ( 'throws for an unsupported platform' , async ( ) => {
104+ const ctx = makeCtx ( { platform : Platform . ANDROID , channel : 'production' } ) ;
105+ ( ctx . job as { platform : string } ) . platform = 'web' ;
106+
107+ await expect ( uploadEmbeddedBundleAsync ( ctx ) ) . rejects . toThrow (
108+ 'Uploading embedded updates is not supported for the web platform.'
109+ ) ;
110+ expect ( artifacts . findArtifacts ) . not . toHaveBeenCalled ( ) ;
100111 } ) ;
101112
102113 it ( 'uploads from Android APK archives' , async ( ) => {
@@ -243,4 +254,20 @@ describe('uploadEmbeddedBundleAsync', () => {
243254 ) ;
244255 expect ( ctx . markBuildPhaseHasWarnings ) . toHaveBeenCalled ( ) ;
245256 } ) ;
257+
258+ it ( 'swallows zip.close() failures so they do not mask the upload result' , async ( ) => {
259+ jest . mocked ( artifacts . findArtifacts ) . mockResolvedValue ( [ '/tmp/app-release.apk' ] ) ;
260+ mockZipEntries . mockResolvedValue (
261+ zipEntryMap ( {
262+ 'assets/index.android.bundle' : true ,
263+ 'assets/app.manifest' : true ,
264+ } )
265+ ) ;
266+ mockZipClose . mockRejectedValue ( new Error ( 'close failed' ) ) ;
267+ const ctx = makeCtx ( { platform : Platform . ANDROID , channel : 'production' } ) ;
268+
269+ await expect ( uploadEmbeddedBundleAsync ( ctx ) ) . resolves . toBeUndefined ( ) ;
270+ expect ( easCli . runEasCliCommand ) . toHaveBeenCalled ( ) ;
271+ expect ( mockZipClose ) . toHaveBeenCalled ( ) ;
272+ } ) ;
246273} ) ;
0 commit comments