@@ -25,6 +25,7 @@ function expectResolvesAsset(input, expectedSource) {
25
25
describe ( 'resolveAssetSource' , ( ) => {
26
26
beforeEach ( ( ) => {
27
27
jest . resetModuleRegistry ( ) ;
28
+ __DEV__ = true ;
28
29
AssetRegistry = require ( 'AssetRegistry' ) ;
29
30
Platform = require ( 'Platform' ) ;
30
31
SourceCode = require ( 'NativeModules' ) . SourceCode ;
@@ -64,6 +65,7 @@ describe('resolveAssetSource', () => {
64
65
describe ( 'bundle was loaded from network (DEV)' , ( ) => {
65
66
beforeEach ( ( ) => {
66
67
SourceCode . scriptURL = 'http://10.0.0.1:8081/main.bundle' ;
68
+ Platform . OS = 'ios' ;
67
69
} ) ;
68
70
69
71
it ( 'uses network image' , ( ) => {
@@ -81,7 +83,7 @@ describe('resolveAssetSource', () => {
81
83
isStatic : false ,
82
84
width : 100 ,
83
85
height : 200 ,
84
- uri : 'http://10.0.0.1:8081/assets/module/a/logo.png?hash=5b6f00f' ,
86
+ uri : 'http://10.0.0.1:8081/assets/module/a/logo.png?platform=ios& hash=5b6f00f' ,
85
87
} ) ;
86
88
} ) ;
87
89
@@ -100,29 +102,19 @@ describe('resolveAssetSource', () => {
100
102
isStatic : false ,
101
103
width : 100 ,
102
104
height : 200 ,
103
- uri :
'http://10.0.0.1:8081/assets/module/a/[email protected] ?hash=5b6f00f' ,
105
+ uri :
'http://10.0.0.1:8081/assets/module/a/[email protected] ?platform=ios& hash=5b6f00f' ,
104
106
} ) ;
105
107
} ) ;
106
108
107
109
} ) ;
108
110
109
111
describe ( 'bundle was loaded from file (PROD) on iOS' , ( ) => {
110
- var originalDevMode ;
111
- var originalPlatform ;
112
-
113
112
beforeEach ( ( ) => {
114
113
SourceCode . scriptURL = 'file:///Path/To/Simulator/main.bundle' ;
115
- originalDevMode = __DEV__ ;
116
- originalPlatform = Platform . OS ;
117
114
__DEV__ = false ;
118
115
Platform . OS = 'ios' ;
119
116
} ) ;
120
117
121
- afterEach ( ( ) => {
122
- __DEV__ = originalDevMode ;
123
- Platform . OS = originalPlatform ;
124
- } ) ;
125
-
126
118
it ( 'uses pre-packed image' , ( ) => {
127
119
expectResolvesAsset ( {
128
120
__packager_asset : true ,
@@ -144,22 +136,12 @@ describe('resolveAssetSource', () => {
144
136
} ) ;
145
137
146
138
describe ( 'bundle was loaded from file (PROD) on Android' , ( ) => {
147
- var originalDevMode ;
148
- var originalPlatform ;
149
-
150
139
beforeEach ( ( ) => {
151
140
SourceCode . scriptURL = 'file:///Path/To/Simulator/main.bundle' ;
152
- originalDevMode = __DEV__ ;
153
- originalPlatform = Platform . OS ;
154
141
__DEV__ = false ;
155
142
Platform . OS = 'android' ;
156
143
} ) ;
157
144
158
- afterEach ( ( ) => {
159
- __DEV__ = originalDevMode ;
160
- Platform . OS = originalPlatform ;
161
- } ) ;
162
-
163
145
it ( 'uses pre-packed image' , ( ) => {
164
146
expectResolvesAsset ( {
165
147
__packager_asset : true ,
0 commit comments