tests
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
for integration tests, there needs to be an application with the
the below 6 snippets
on production, and staging there is an application called
"cloudmine-integration" in geoff's account that serves this purpose. For rackspace, Mike Caputo has the cloudmine-integration app.
test_integer:
exit(42);
test_array:
exit(["one", 2]);
test_string:
exit("I'm a string");
reverse:
function reverse(data) {
if (data && typeof data == 'object' && data.length) {
var out = Array(data.length);
for (var i = 0; i < data.length; ++i) {
out[i] = reverse(data[i]);
}
return out;
}
else if (data && typeof data == 'object') {
var out = {};
for (var key in data) {
if (data.hasOwnProperty(key)) out[key] = reverse(data[key]);
}
return out;
}
else if (typeof data == 'string') {
var out = "";
for (var i = 0, c = data.length; i < data.length; ++i) {
out += data[--c];
}
return out;
}
return data;
}
exit(reverse(data));
test_standalone:
exit({
you_sent: data.params,
i_am: 'test_standalone'
});
create_object:
var cloudmine = require("cloudmine");
var ws = new cloudmine.WebService({
appid: '4d2631c701a74e11a17197f5bcf506b5',
apikey: '20DF680D234C441B9869A21B8FEB6523',
apiroot:'https://api.cloudmine.io'
});
var d = new Date();
var obj = {testkey: d.toString()};
console.log(obj);
ws.set(obj);
exit({"done": true});