Files
zulip/zephyr/tests/frontend/node/message_tour.js
Steve Howell 2442edee9e Add the "static" directory to NODE_PATH for unit tests.
I added our "static" directory to NODE_PATH for our JS unit tests.
This eliminates most of the verbosity in our require statements, but
it still requires us to explicitly call out "js" or "third"
subdirectories, which should make it a bit easier for folks reading
the tests to distinguish modules from js, third, or node itself.

(imported from commit b77a5283135d388d46f4b7e511acc59986f1a8ba)
2013-08-01 17:58:25 -04:00

24 lines
814 B
JavaScript

// This is a framework-free unit test for the message_tour.js
// module. There's a long comment there explaining the module's
// purpose, but, briefly, it provides an API to keep track of
// messages that you visit on a "tour."
var message_tour = require('js/message_tour.js');
var assert = require('assert');
(function test_basic_tour() {
message_tour.start_tour(5);
message_tour.visit(3); // too small
message_tour.visit(7);
message_tour.visit(6);
message_tour.visit(4); // too small
assert.deepEqual(message_tour.get_tour(), [7,6]);
message_tour.finish_tour();
assert.deepEqual(message_tour.get_tour(), []);
message_tour.visit(7); // should be ignored
message_tour.start_tour(5);
message_tour.visit(13);
assert.deepEqual(message_tour.get_tour(), [13]);
}());