Skip to content

Instantly share code, notes, and snippets.

@pscollins
Created February 3, 2015 05:42
Show Gist options
  • Save pscollins/9b1b41ed424820257712 to your computer and use it in GitHub Desktop.
Save pscollins/9b1b41ed424820257712 to your computer and use it in GitHub Desktop.
Bad test?
vows = require 'vows'
assert = require 'assert'
phantom = require '../phantom'
describe = (name, bat) -> vows.describe(name).addBatch(bat).export(module)
# Make coffeescript not return anything
# This is needed because vows topics do different things if you have a return value
t = (fn) ->
->
fn.apply this, arguments
return
describe "The phantom module (error behavior)",
"Cannot create an instance at a nonexistent path":
topic: t ->
phantom.create {port: 12302}, (ph, err) =>
console.log "CREATED"
@callback null, [ph, err]
"which is null": ([ph, err]) ->
assert.isNull ph
"which returned an error": ([ph, err]) ->
assert.isObject err
"with an error code of ENOENT": ([ph, err]) ->
assert.strictEqual err?.code, "ENOENT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment