/*global afterEach, beforeEach, it */
'use strict';
var assert = require('assert');
var fs = require('fs');
var rm = require('rimraf');
var pageres = require('./index');

afterEach(function (cb) {
	process.chdir('../');
	rm('tmp', cb);
});

beforeEach(function (cb) {
	fs.mkdirSync('tmp');
	process.chdir('tmp');
	cb();
});

it('should generate screenshots', function (cb) {
	this.timeout(20000);
	pageres(['yeoman.io', 'todomvc.com'], ['1024x768', '640x480'], function () {
		assert(fs.existsSync('yeoman.io-640x480.png'));
		assert(fs.existsSync('yeoman.io-1024x768.png'));
		assert(fs.existsSync('todomvc.com-640x480.png'));
		assert(fs.existsSync('todomvc.com-1024x768.png'));
		cb();
	});
});

/*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'], 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();
		});
	});
});

fix tests