-
Notifications
You must be signed in to change notification settings - Fork 8
/
test.js
33 lines (27 loc) · 794 Bytes
/
test.js
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
33
'use strict';
var fs = require('fs');
var assert = require('assert');
var gutil = require('gulp-util');
var sizeOf = require('image-size');
var localScreenshots = require('./index');
var dimensions;
it('It should generate properly screenshot', function (cb) {
var stream = localScreenshots({height: 500});
stream.on('data', function(){
});
stream.on('end', function(){
console.log('\r\n');
dimensions = sizeOf('screens/index-1024.jpg');
assert.equal(dimensions.width, 1024);
assert.equal(dimensions.height, 500);
fs.unlinkSync('screens/index-1024.jpg');
fs.rmdirSync('screens');
cb();
});
stream.write(new gutil.File({
base: __dirname,
path: __dirname + '/public/index.html',
contents: new Buffer('unicorns')
}));
stream.end();
});