@@ -268,69 +268,52 @@ describe('Runtime requireModule', () => {
268268 } ) ;
269269
270270 it ( 'resolves platform extensions based on the default platform' , async ( ) => {
271- await Promise . all ( [
272- createRuntime ( __filename ) . then ( runtime => {
273- const exports = runtime . requireModule (
274- runtime . __mockRootPath ,
275- 'Platform' ,
276- ) ;
277-
278- expect ( exports . platform ) . toBe ( 'default' ) ;
279- } ) ,
280- createRuntime ( __filename , {
281- haste : {
282- defaultPlatform : 'ios' ,
283- platforms : [ 'ios' , 'android' ] ,
284- } ,
285- } ) . then ( runtime => {
286- const exports = runtime . requireModule (
287- runtime . __mockRootPath ,
288- 'Platform' ,
289- ) ;
290-
291- expect ( exports . platform ) . toBe ( 'ios' ) ;
292- } ) ,
293- createRuntime ( __filename , {
294- haste : {
295- platforms : [ 'ios' , 'android' ] ,
296- } ,
297- } ) . then ( runtime => {
298- const exports = runtime . requireModule (
299- runtime . __mockRootPath ,
300- 'Platform' ,
301- ) ;
302-
303- expect ( exports . platform ) . toBe ( 'default' ) ;
304- } ) ,
305- createRuntime ( __filename , {
306- haste : {
307- defaultPlatform : 'android' ,
308- platforms : [ 'ios' , 'android' ] ,
309- } ,
310- } ) . then ( runtime => {
311- const exports = runtime . requireModule (
312- runtime . __mockRootPath ,
313- 'Platform' ,
314- ) ;
315-
316- expect ( exports . platform ) . toBe ( 'android' ) ;
317- } ) ,
318- createRuntime ( __filename , {
319- haste : {
320- defaultPlatform : 'windows' ,
321- platforms : [ 'ios' , 'android' , 'native' , 'windows' ] ,
322- } ,
323- } ) . then ( runtime => {
324- const exports = runtime . requireModule (
325- runtime . __mockRootPath ,
326- 'Platform' ,
327- ) ;
328-
329- // We prefer `native` over the default module if the default one
330- // cannot be found.
331- expect ( exports . platform ) . toBe ( 'native' ) ;
332- } ) ,
333- ] ) ;
271+ await createRuntime ( __filename ) . then ( runtime => {
272+ const exports = runtime . requireModule ( runtime . __mockRootPath , 'Platform' ) ;
273+
274+ expect ( exports . platform ) . toBe ( 'default' ) ;
275+ } ) ;
276+ await createRuntime ( __filename , {
277+ haste : {
278+ defaultPlatform : 'ios' ,
279+ platforms : [ 'ios' , 'android' ] ,
280+ } ,
281+ } ) . then ( runtime => {
282+ const exports = runtime . requireModule ( runtime . __mockRootPath , 'Platform' ) ;
283+
284+ expect ( exports . platform ) . toBe ( 'ios' ) ;
285+ } ) ;
286+ await createRuntime ( __filename , {
287+ haste : {
288+ platforms : [ 'ios' , 'android' ] ,
289+ } ,
290+ } ) . then ( runtime => {
291+ const exports = runtime . requireModule ( runtime . __mockRootPath , 'Platform' ) ;
292+
293+ expect ( exports . platform ) . toBe ( 'default' ) ;
294+ } ) ;
295+ await createRuntime ( __filename , {
296+ haste : {
297+ defaultPlatform : 'android' ,
298+ platforms : [ 'ios' , 'android' ] ,
299+ } ,
300+ } ) . then ( runtime => {
301+ const exports = runtime . requireModule ( runtime . __mockRootPath , 'Platform' ) ;
302+
303+ expect ( exports . platform ) . toBe ( 'android' ) ;
304+ } ) ;
305+ await createRuntime ( __filename , {
306+ haste : {
307+ defaultPlatform : 'windows' ,
308+ platforms : [ 'ios' , 'android' , 'native' , 'windows' ] ,
309+ } ,
310+ } ) . then ( runtime => {
311+ const exports = runtime . requireModule ( runtime . __mockRootPath , 'Platform' ) ;
312+
313+ // We prefer `native` over the default module if the default one
314+ // cannot be found.
315+ expect ( exports . platform ) . toBe ( 'native' ) ;
316+ } ) ;
334317 } ) ;
335318
336319 it ( 'finds modules encoded in UTF-8 *with BOM*' , async ( ) => {
0 commit comments