Skip to content

Commit 19b2b46

Browse files
committed
Added constant for image type error.
1 parent d1ad042 commit 19b2b46

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

spec/ImageDiff.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ describe('ImageUtils', function() {
33
var
44
OBJECT = 'object',
55
TYPE_CANVAS = '[object HTMLCanvasElement]',
6-
TYPE_IMAGE_DATA = '[object ImageData]';
6+
TYPE_IMAGE_DATA = '[object ImageData]',
7+
E_TYPE = { name : 'ImageTypeError', message : 'Submitted object was not an image.' };
78

89
function getContext () {
910
var
@@ -140,12 +141,9 @@ describe('ImageUtils', function() {
140141
});
141142

142143
it('should fail on non-ImageType', function () {
143-
var
144-
e = { name : 'ImageTypeError', message : 'Submitted object was not an image.' };
145-
146-
expect(function () { imagediff.toImageData() }).toThrow(e);
147-
expect(function () { imagediff.toImageData('') }).toThrow(e);
148-
expect(function () { imagediff.toImageData({}) }).toThrow(e);
144+
expect(function () { imagediff.toImageData() }).toThrow(E_TYPE);
145+
expect(function () { imagediff.toImageData('') }).toThrow(E_TYPE);
146+
expect(function () { imagediff.toImageData({}) }).toThrow(E_TYPE);
149147
});
150148
});
151149
});

0 commit comments

Comments
 (0)