Created
February 24, 2011 12:05
-
-
Save commandodev/842093 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zombie = require "zombie" | |
testCase = require("nodeunit").testCase | |
_ = require "underscore" | |
tests = | |
setUp: (cb) -> | |
zombie.visit "http://localhost:<port>/websocket_page_url/", {debug: false}, (err, browser, stat) -> | |
@browser = browser | |
# Set sensible timout for initial page set up to be done | |
setTimeout cb, 100 | |
test_something: (test) -> | |
test.expect 2 | |
row_views = browser.evaluate "window.something_dependent_on_websocket_message()" | |
test.ok row_views.length == 25 | |
# Test something on a backbone model | |
test.equal row_views[0].model.id, 1 | |
test.done() | |
test_something_else: (test) -> | |
test.expect 1 | |
result = browser.evaluate "view.websocket_backed_backbone_collection.models[0].model_method()" | |
test.ok result, "Result returned from a model method is ok" | |
test.done() | |
module.exports = testCase(tests) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment