Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment