Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juliangruber committed Aug 26, 2013
1 parent 6812587 commit a56c5b2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 10 deletions.
29 changes: 19 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
{
"name" : "url-to-screenshot",
"description" : "Capture screenshots using phantomjs",
"version" : "0.0.0",
"repository" : {
"type" : "git",
"url" : "git://github.com/re-view/url-to-screenshot.git"
"name": "url-to-screenshot",
"description": "Capture screenshots using phantomjs",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "git://github.com/re-view/url-to-screenshot.git"
},
"scripts": {
"test": "tape test.js"
},
"homepage": "https://github.com/re-view/url-to-screenshot",
"main" : "index.js",
"dependencies" : {},
"devDependencies" : {},
"keywords": ["phantomjs", "screenshot", "headless"],
"main": "index.js",
"dependencies": {},
"devDependencies": {
"tape": "~1.0.4"
},
"keywords": [
"phantomjs",
"screenshot",
"headless"
],
"author": {
"name": "Julian Gruber",
"email": "[email protected]",
Expand Down
26 changes: 26 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var test = require('tape');
var Screenshot = require('./');

test('screenshot', function(t) {
t.plan(3);
Screenshot('http://google.com')
.capture(function(err, pic) {
t.error(err);
t.ok(pic);
t.ok(Buffer.isBuffer(pic));
});
});

test('custom args', function(t) {
t.plan(3);
Screenshot('http://google.com')
.width(1024)
.height(768)
.timeout(100)
.format('jpeg')
.capture(function(err, pic) {
t.error(err);
t.ok(pic);
t.ok(Buffer.isBuffer(pic));
});
});

0 comments on commit a56c5b2

Please sign in to comment.