Skip to content

Instantly share code, notes, and snippets.

@varl
Last active December 16, 2015 08:08
Show Gist options
  • Save varl/5403312 to your computer and use it in GitHub Desktop.
Save varl/5403312 to your computer and use it in GitHub Desktop.
var Indexer = require('./IndexPrinter.js');
module.exports = {
setUp: function (callback) {
text = "foo|bar\nbaz|bath";
this.indexer = new Indexer(text);
callback();
},
testContainsKey: function (test) {
test.ok(this.indexer.containsKey("foo"));
test.ok(this.indexer.containsKey("baz"));
test.ok(!this.indexer.containsKey("hello"));
test.done();
},
testGetItem: function (test) {
test.strictEqual(this.indexer.getValue("foo"), "bar");
test.strictEqual(this.indexer.getValue("baz"), "bath");
test.ok(!this.indexer.getValue("buz"));
test.done();
}
}
@varl
Copy link
Author

varl commented Apr 18, 2013

$ ./node_modules/nodeunit/bin/nodeunit test.js

test.js
✔ testContainsKey
Found key: foo
Got item: bar
Found key: baz
Got item: bath
Did not find key: buz
✔ testGetItem

OK: 6 assertions (11ms)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment