@nicodoggie/node-kiwi-tcms-api
Version:
Vibe-coded Node.js wrapper for Kiwi TCMS XML-RPC API. Use at your own risk.
93 lines • 2.94 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestPlanAPI = void 0;
/**
* Test Plan API module
*/
class TestPlanAPI {
client;
constructor(client) {
this.client = client;
}
/**
* Create a new test plan
*/
async create(testPlanData) {
return await this.client.authenticatedCall('TestPlan.create', [testPlanData]);
}
async filter(query = {}, options) {
const testPlans = await this.client.authenticatedCall('TestPlan.filter', [query]);
if (options?.includePermalinks) {
// Get URL API instance from the main client
const urlApi = this.getUrlApi();
return urlApi.injectPermalinksArray('plan', testPlans, 'name');
}
return testPlans;
}
/**
* Get the URL API instance for permalink injection
* @private
*/
getUrlApi() {
// Import here to avoid circular dependencies
const { UrlAPI } = require('./utilities');
return new UrlAPI(this.client);
}
/**
* Update a test plan
*/
async update(testPlanId, updateData) {
return await this.client.authenticatedCall('TestPlan.update', [testPlanId, updateData]);
}
/**
* Add a test case to test plan
*/
async addCase(testPlanId, testCaseId) {
await this.client.authenticatedCall('TestPlan.add_case', [testPlanId, testCaseId]);
}
/**
* Remove a test case from test plan
*/
async removeCase(testPlanId, testCaseId) {
await this.client.authenticatedCall('TestPlan.remove_case', [testPlanId, testCaseId]);
}
/**
* Update test case order in test plan
*/
async updateCaseOrder(testPlanId, caseOrders) {
await this.client.authenticatedCall('TestPlan.update_case_order', [testPlanId, caseOrders]);
}
/**
* Add a tag to test plan
*/
async addTag(testPlanId, tag) {
return await this.client.authenticatedCall('TestPlan.add_tag', [testPlanId, tag]);
}
/**
* Remove a tag from test plan
*/
async removeTag(testPlanId, tag) {
await this.client.authenticatedCall('TestPlan.remove_tag', [testPlanId, tag]);
}
/**
* Add an attachment to test plan
*/
async addAttachment(testPlanId, filename, b64content) {
return await this.client.authenticatedCall('TestPlan.add_attachment', [testPlanId, filename, b64content]);
}
/**
* List attachments for test plan
*/
async listAttachments(testPlanId) {
return await this.client.authenticatedCall('TestPlan.list_attachments', [testPlanId]);
}
/**
* Get test plan tree structure
*/
async tree(testPlanId) {
const params = testPlanId ? [testPlanId] : [];
return await this.client.authenticatedCall('TestPlan.tree', params);
}
}
exports.TestPlanAPI = TestPlanAPI;
//# sourceMappingURL=testplan.js.map