var assert = require('assert');
var helix_web_services_client = require('../index.js');
var test_methods = require('./util/test_methods');
var string_methods = require('./util/string_methods');
var done = false;
test_methods.clientAsSuper(function (err, c) {
if (err) {
console.log("ERROR", err);
assert(false);
}
var api = c.createDefaultApi();
var rand = string_methods.randomString();
var counter = new helix_web_services_client.models.Counter({
value: "1"
});
api.serverCountersCounterPut("localhost", rand, counter, function(err) {
if (err) {
console.log("ERROR", err);
assert(false);
}
api.serverCountersGet("localhost", function(err, allCounters) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(allCounters.find(function(c) { return c.counter == rand && c.value == "1"; }));
api.serverCountersCounterGet("localhost", rand, function(err, saved) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(saved.value == "1");
api.serverCountersCounterIncrementPost("localhost", rand, function(err) {
if (err) {
console.log("ERROR", err);
assert(false);
}
api.serverCountersCounterGet("localhost", rand, function(err, incremented) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(incremented.value == "2");
api.serverCountersCounterDelete("localhost", rand, function(err) {
if (err) {
console.log("ERROR", err);
assert(false);
}
api.serverCountersGet("localhost", function(err, allCounters2) {
if (err) {
console.log("ERROR", err);
assert(false);
}
assert(!allCounters2.find(function(c) { return c.counter == rand && c.value == "1"; }));
done = true;
});
});
});
})
});
});
});
});
function checkForDone() {
if (!done) {
setTimeout(checkForDone, 500);
}
}
setTimeout(checkForDone, 0);
# |
Change |
User |
Description |
Committed |
|
#1
|
19553 |
swellard |
Move and rename clients |
|
|
//guest/perforce_software/helix-web-services/main/source/clients/2016.1.0/javascript/test/default_api.server_counters.crud.js |
#1
|
19127 |
tjuricek |
Javascript client SDK counter CRUD tests |
|
|