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.clientAsJdoe(function (err, c) { if (err) { console.log("ERROR", err); assert(false); } var api = c.createDefaultApi(); var rand = string_methods.randomString(); var branchName = "test-branch-" + rand; var branchCommand = new helix_web_services_client.models.BranchCommand({ branch: branchName, view: [ "//depot/main/" + branchName + "/... //depot/dev/" + branchName + "/..." ] }); api.serverBranchesPost("localhost", branchCommand, function(err, commandResponse) { if (err) { console.log("ERROR", err); assert(false); } api.serverBranchesGet("localhost", function(err, branches) { if (err) { console.log("ERROR", err); assert(false); } assert(branches.find(function(b) { return b.branch == branchName; }) != null, "did not locate new branch"); api.serverBranchesBranchGet("localhost", branchName, function(err, saved) { if (err) { console.log("ERROR", err); assert(false); } assert(saved.view.length == branchCommand.view.length); for (var idx = 0; idx < saved.view.length; ++idx) { assert(saved.view[idx] == branchCommand.view[idx]); } var toUpdate = new helix_web_services_client.models.BranchCommand({ description: "test " + rand }); api.serverBranchesBranchPatch("localhost", branchName, toUpdate, function (err) { if (err) { console.log("ERROR", err); assert(false); } api.serverBranchesBranchGet("localhost", branchName, function(err, updated) { if (err) { console.log("ERROR", err); assert(false); } assert(toUpdate.description.trim() == updated.description.trim()); api.serverBranchesBranchDelete("localhost", branchName, function(err) { if (err) { console.log("ERROR", err); assert(false); } api.serverBranchesGet("localhost", function (err, branches2) { if (err) { console.log("ERROR", err); assert(false); } assert(branches2.find(function(b) { return b.branch == branchName; }) == null, "branch was not deleted"); 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_branches.crud.js | |||||
#2 | 19128 | tjuricek | Javascript client SDK group CRUD tests, and a wee bit of refinement on the branches spec | ||
#1 | 19095 | tjuricek |
JS Client SDK branch spec CRUD test Added URL component encoding on path parameters. |