1
1
require ( 'jsdom-global' ) ( )
2
2
3
3
const assert = require ( 'assert' )
4
- const { loadImage , loadImages } = require ( './' )
4
+ const imagesLoader = require ( './' )
5
5
6
6
7
7
const LOAD_FAILURE_SRC = 'succes.jpg'
@@ -21,10 +21,18 @@ Object.defineProperty(global.Image.prototype, 'src', {
21
21
22
22
23
23
describe ( 'Bianco images-loader' , function ( ) {
24
+
25
+ it ( 'export default contains all the module methods' , function ( ) {
26
+ assert . deepEqual ( Object . keys ( imagesLoader . default ) , [
27
+ 'loadImage' ,
28
+ 'loadImages'
29
+ ] )
30
+ } )
31
+
24
32
it ( 'It can load images in the DOM' , function ( done ) {
25
33
const img = document . createElement ( 'img' )
26
34
27
- loadImage ( img ) . then ( function ( i ) {
35
+ imagesLoader . loadImage ( img ) . then ( function ( i ) {
28
36
assert . ok ( i )
29
37
done ( )
30
38
} )
@@ -36,7 +44,7 @@ describe('Bianco images-loader', function() {
36
44
it ( 'It can throw properly the errors' , function ( done ) {
37
45
const img = document . createElement ( 'img' )
38
46
39
- loadImage ( img ) . then ( ( ) => {
47
+ imagesLoader . loadImage ( img ) . then ( ( ) => {
40
48
throw 'This image should be not loaded'
41
49
} ) . catch ( function ( e ) {
42
50
assert . ok ( e instanceof Error )
@@ -47,7 +55,7 @@ describe('Bianco images-loader', function() {
47
55
} )
48
56
49
57
it ( 'It can load arrays of images urls' , function ( done ) {
50
- loadImages ( [ LOAD_SUCCESS_SRC , LOAD_SUCCESS_SRC ] ) . then ( function ( imgs ) {
58
+ imagesLoader . loadImages ( [ LOAD_SUCCESS_SRC , LOAD_SUCCESS_SRC ] ) . then ( function ( imgs ) {
51
59
assert . equal ( imgs . length , 2 )
52
60
done ( )
53
61
} )
0 commit comments