@@ -19,15 +19,27 @@ test('URLs', function (t) {
19
19
t . plan ( images . length )
20
20
21
21
for ( var i = 0 ; i < images . length ; i ++ )
22
- urlTest ( t , images [ i ] [ 0 ] , images [ i ] [ 1 ] )
22
+ urlTest ( images [ i ] [ 0 ] , images [ i ] [ 1 ] )
23
+
24
+ function urlTest ( name , number ) {
25
+ baseTest ( t , name , name , number )
26
+ }
23
27
} )
24
28
25
29
test ( 'Blobs' , function ( t ) {
26
30
t . timeoutAfter ( 5000 )
27
31
t . plan ( images . length )
28
32
29
33
for ( var i = 0 ; i < images . length ; i ++ )
30
- blobTest ( t , images [ i ] [ 0 ] , images [ i ] [ 1 ] )
34
+ blobTest ( images [ i ] [ 0 ] , images [ i ] [ 1 ] )
35
+
36
+ function blobTest ( name , number ) {
37
+ getBlobFromImageUrl ( name )
38
+ . then ( function ( blob ) {
39
+ baseTest ( t , name , blob , number )
40
+ } )
41
+ . catch ( t . fail )
42
+ }
31
43
} )
32
44
33
45
test ( 'Failure' , function ( t ) {
@@ -76,18 +88,6 @@ function baseTest (t, name, input, number) {
76
88
}
77
89
}
78
90
79
- function urlTest ( t , name , number ) {
80
- baseTest ( t , name , name , number )
81
- }
82
-
83
- function blobTest ( t , name , number ) {
84
- getBlobFromImageUrl ( name )
85
- . then ( function ( blob ) {
86
- baseTest ( t , name , blob , number )
87
- } )
88
- . catch ( t . fail )
89
- }
90
-
91
91
// Helper
92
92
function getBlobFromImageUrl ( url ) {
93
93
return new Promise ( function ( resolve , reject ) {
0 commit comments