Skip to content

Commit

Permalink
Testing collections
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelgrosner committed Feb 15, 2015
1 parent e07a1af commit e0b9e10
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 11 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@
"test": "test"
},
"dependencies": {
"collections": "^1.2.1",
"angularjs": "^0.0.1",
"connect": "^3.2.0",
"collections": "^1.2.1",
"compression": "^1.3.0",
"connect": "^3.2.0",
"express": "^4.8.8",
"faye": "^1.0.3",
"lodash": "^2.4.1",
"knockout": "^3.2.0",
"jquery": "^2.1.1",
"grunt": "^0.4.5",
"grunt-contrib-watch": "^0.6.1",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-ts": "^1.12.1",
"node-uuid": "^1.4.2",
"jquery": "^2.1.1",
"knockout": "^3.2.0",
"lodash": "^2.4.1",
"moment": "^2.8.3",
"mongodb": "^1.4.22",
"serve-static": "^1.6.4",
"node-uuid": "^1.4.2",
"q": "^1.0.1",
"request": "^2.44.0",
"serve-static": "^1.6.4",
"shortid": "^2.1.3",
"socket.io": "^1.3.2",
"tsd": "^0.5.7",
"socket.io-client": "^1.3.2",
"tsd": "^0.5.7",
"typescript": "^1.4.1",
"utf8": "^2.0.0",
"winston": "^0.8.3",
"zmq": "^2.8.0",
"ws": "^0.4.32"
"ws": "^0.4.32",
"zmq": "^2.8.0"
},
"devDependencies": {
"mocha": "^2.0.1"
Expand Down
35 changes: 35 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
var assert = require("assert");
var util = require("util");
var SortedArray = require("collections/sorted-array");
var _ = require("lodash");


describe('HitBtc', function () {
describe('map', function () {
it('should work', function () {

var incoming = [
{ price: 239.31, size: 17 },
{ price: 239.99, size: 33 },
{ price: 239.67, size: 1 },
{ price: 239.75, size: 44 },
{ price: 238.56, size: 25 }
];

var cmp = function(a, b) {
if (a.price === b.price) return 0;
return a.price > b.price ? 1 : -1
};

var lastBids = new SortedArray([], null, cmp);

for (var i = 0; i < incoming.length; i++) {
lastBids.push(incoming[i]);
}

console.log(util.inspect(lastBids, true, 500, true));

assert(lastBids.has(incoming[0]));
})
});
});

0 comments on commit e0b9e10

Please sign in to comment.