You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 15, 2025. It is now read-only.
@@ -109,7 +94,7 @@ describe('CacheableImage', function () {
109
94
110
95
it('#flush static method should work as expected.',()=>{
111
96
// Mock unlink to always be true.
112
-
RNFS.unlink.mockResolvedValue(true)
97
+
MockedRNFS.unlink.mockResolvedValueOnce()
113
98
114
99
constCacheableImage=imageCacheHoc(Image)
115
100
@@ -140,8 +125,7 @@ describe('CacheableImage', function () {
140
125
})
141
126
142
127
it('#_validateImageComponent should validate bad component props correctly.',()=>{
143
-
constconsoleOutput=[]
144
-
console.warn=(output)=>consoleOutput.push(output)
128
+
console.warn=jest.fn()
145
129
146
130
// Verify source uri prop only accepts web accessible urls.
147
131
@@ -153,9 +137,10 @@ describe('CacheableImage', function () {
153
137
},
154
138
})
155
139
156
-
expect(consoleOutput).toEqual([
140
+
expect(console.warn).toHaveBeenNthCalledWith(
141
+
1,
157
142
'Invalid source prop. <CacheableImage> props.source.uri should be a web accessible url with a valid protocol and host. NOTE: Default valid protocol is https, default valid hosts are *.',
158
-
])
143
+
)
159
144
160
145
// Verify source uri prop only accepts web accessible urls from whitelist if whitelist set.
161
146
@@ -170,10 +155,10 @@ describe('CacheableImage', function () {
170
155
},
171
156
})
172
157
173
-
expect(consoleOutput).toEqual([
158
+
expect(console.warn).toHaveBeenNthCalledWith(
159
+
2,
174
160
'Invalid source prop. <CacheableImage> props.source.uri should be a web accessible url with a valid protocol and host. NOTE: Default valid protocol is https, default valid hosts are *.',
175
-
'Invalid source prop. <CacheableImage> props.source.uri should be a web accessible url with a valid protocol and host. NOTE: Default valid protocol is https, default valid hosts are *.',
176
-
])
161
+
)
177
162
178
163
// Verify source uri prop only accepts web accessible urls from correct protocols if protocol list set.
179
164
@@ -188,11 +173,10 @@ describe('CacheableImage', function () {
188
173
},
189
174
})
190
175
191
-
expect(consoleOutput).toEqual([
192
-
'Invalid source prop. <CacheableImage> props.source.uri should be a web accessible url with a valid protocol and host. NOTE: Default valid protocol is https, default valid hosts are *.',
193
-
'Invalid source prop. <CacheableImage> props.source.uri should be a web accessible url with a valid protocol and host. NOTE: Default valid protocol is https, default valid hosts are *.',
176
+
expect(console.warn).toHaveBeenNthCalledWith(
177
+
3,
194
178
'Invalid source prop. <CacheableImage> props.source.uri should be a web accessible url with a valid protocol and host. NOTE: Default valid protocol is https, default valid hosts are *.',
195
-
])
179
+
)
196
180
})
197
181
198
182
it('Verify component is actually still mounted before calling setState() in componentDidMount().',async()=>{
@@ -206,7 +190,7 @@ describe('CacheableImage', function () {
0 commit comments