Skip to content

Instantly share code, notes, and snippets.

@ariya
Created July 28, 2014 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariya/ec0509924278709de977 to your computer and use it in GitHub Desktop.
Save ariya/ec0509924278709de977 to your computer and use it in GitHub Desktop.
Sample test for PhantomJS 2
typeof phantom is object
typeof phantom.version is object
typeof phantom.args is object
typeof phantom.args.length is number
typeof phantom.scriptName is string
typeof phantom.exit is function
phantom.version.major is 2
phantom.version.minor is 0
phantom.version.patch is 0
function assert(msg, actual, expected) {
if (actual == expected) {
console.log(msg, actual);
} else {
console.log(msg, actual, ' -> FAIL: expecting', expected);
}
}
assert('typeof phantom is', typeof phantom, 'object');
assert('typeof phantom.version is', typeof phantom.version, 'object');
assert('typeof phantom.args is', typeof phantom.args, 'object');
assert('typeof phantom.args.length is', typeof phantom.args.length, 'number');
assert('typeof phantom.scriptName is', typeof phantom.scriptName, 'string');
assert('typeof phantom.exit is', typeof phantom.exit, 'function');
assert('phantom.version.major is', phantom.version.major, 2);
assert('phantom.version.minor is', phantom.version.minor, 0);
assert('phantom.version.patch is', phantom.version.patch, 0);
phantom.exit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment