-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest.js
More file actions
32 lines (26 loc) · 698 Bytes
/
test.js
File metadata and controls
32 lines (26 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
var fs = require('fs');
var assert = require('assert');
var gutil = require('gulp-util');
var imagemin = require('./index');
it('should minify images', function (cb) {
var stream = imagemin();
stream.on('data', function (file) {
assert(file.contents.length < fs.statSync('fixture.png').size);
cb();
});
stream.write(new gutil.File({
path: __dirname + '/fixture.png',
contents: fs.readFileSync('fixture.png')
}));
});
it('should skip unsupported images', function (cb) {
var stream = imagemin();
stream.on('data', function (file) {
assert.strictEqual(file.contents, null);
cb();
});
stream.write(new gutil.File({
path: __dirname + '/fixture.bmp'
}));
});