Comparing version 0.2.0 to 0.2.1
@@ -31,3 +31,3 @@ // TODO include the event._id (and define a JSON encoding for ObjectId?) | ||
function putter(request, callback) { | ||
var time = new Date(request.time), | ||
var time = "time" in request ? new Date(request.time) : new Date(), | ||
type = request.type; | ||
@@ -34,0 +34,0 @@ |
{ | ||
"name": "cube", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A system for analyzing time series data using MongoDB and Node.", | ||
@@ -5,0 +5,0 @@ "keywords": ["time series"], |
@@ -15,9 +15,2 @@ var vows = require("vows"), | ||
var obj = { type: "test" | ||
, time: (new Date).toISOString() | ||
, data: { foo: "bar" } | ||
}; | ||
var arr = [obj]; | ||
var num = 42; | ||
server.register = cube.collector.register; | ||
@@ -39,3 +32,9 @@ | ||
"POST /event/put with a JSON object": { | ||
topic: test.request({method: "POST", port: port, path: "/1.0/event/put"}, JSON.stringify(obj)), | ||
topic: test.request({method: "POST", port: port, path: "/1.0/event/put"}, JSON.stringify({ | ||
type: "test", | ||
time: new Date, | ||
data: { | ||
foo: "bar" | ||
} | ||
})), | ||
"responds with status 400": function(response) { | ||
@@ -50,3 +49,9 @@ assert.equal(response.statusCode, 400); | ||
"POST /event/put with a JSON array": { | ||
topic: test.request({method: "POST", port: port, path: "/1.0/event/put"}, JSON.stringify(arr)), | ||
topic: test.request({method: "POST", port: port, path: "/1.0/event/put"}, JSON.stringify([{ | ||
type: "test", | ||
time: new Date, | ||
data: { | ||
foo: "bar" | ||
} | ||
}])), | ||
"responds with status 200": function(response) { | ||
@@ -61,3 +66,3 @@ assert.equal(response.statusCode, 200); | ||
"POST /event/put with a JSON number": { | ||
topic: test.request({method: "POST", port: port, path: "/1.0/event/put"}, JSON.stringify(num)), | ||
topic: test.request({method: "POST", port: port, path: "/1.0/event/put"}, JSON.stringify(42)), | ||
"responds with status 400": function(response) { | ||
@@ -70,2 +75,17 @@ assert.equal(response.statusCode, 400); | ||
suite.addBatch(test.batch({ | ||
"POST /event/put without an associated time": { | ||
topic: test.request({method: "POST", port: port, path: "/1.0/event/put"}, JSON.stringify([{ | ||
type: "test", | ||
data: { | ||
foo: "bar" | ||
} | ||
}])), | ||
"responds with status 200": function(response) { | ||
assert.equal(response.statusCode, 200); | ||
assert.deepEqual(JSON.parse(response.body), {}); | ||
} | ||
} | ||
})); | ||
suite.export(module); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
738478
18512
4