forked from sindresorhus/pageres
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
31 lines (26 loc) · 922 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
/*global afterEach, beforeEach, it */
'use strict';
var assert = require('assert');
var fs = require('fs');
var pageres = require('./index');
it('should generate screenshots', function (cb) {
this.timeout(20000);
pageres(['yeoman.io', 'todomvc.com'], ['1024x768', '640x480'], null, function (err, streams) {
assert(!err);
assert.strictEqual(streams.length, 4);
assert.strictEqual(streams[0].filename, 'yeoman.io-1024x768.png');
streams[0].once('data', function (data) {
assert(data.length > 1000);
cb();
});
});
});
it('should remove special characters from the URL to create a valid filename', function (cb) {
this.timeout(20000);
pageres(['http://microsoft.com/?query=pageres*|<>:"\\'], ['1024x768'], null, function (err, streams) {
assert(!err);
assert.strictEqual(streams.length, 1);
assert.strictEqual(streams[0].filename, 'microsoft.com!query=pageres-1024x768.png');
cb();
});
});