@nicodoggie/node-kiwi-tcms-api
Version:
Vibe-coded Node.js wrapper for Kiwi TCMS XML-RPC API. Use at your own risk.
104 lines • 3.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestCaseAPI = void 0;
/**
* Test Case API module
*/
class TestCaseAPI {
client;
constructor(client) {
this.client = client;
}
/**
* Create a new test case
*/
async create(testCaseData) {
return await this.client.authenticatedCall('TestCase.create', [testCaseData]);
}
async filter(query = {}, options) {
const testCases = await this.client.authenticatedCall('TestCase.filter', [query]);
if (options?.includePermalinks) {
// Get URL API instance from the main client
const urlApi = this.getUrlApi();
return urlApi.injectPermalinksArray('case', testCases, 'summary');
}
return testCases;
}
/**
* 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 case
*/
async update(testCaseId, updateData) {
return await this.client.authenticatedCall('TestCase.update', [testCaseId, updateData]);
}
/**
* Remove/delete a test case
*/
async remove(testCaseId) {
await this.client.authenticatedCall('TestCase.remove', [testCaseId]);
}
/**
* Add a comment to test case
*/
async addComment(testCaseId, comment) {
return await this.client.authenticatedCall('TestCase.add_comment', [testCaseId, comment]);
}
/**
* Remove a comment from test case
*/
async removeComment(testCaseId, commentId) {
await this.client.authenticatedCall('TestCase.remove_comment', [testCaseId, commentId]);
}
/**
* Add a tag to test case
*/
async addTag(testCaseId, tag) {
return await this.client.authenticatedCall('TestCase.add_tag', [testCaseId, tag]);
}
/**
* Remove a tag from test case
*/
async removeTag(testCaseId, tag) {
await this.client.authenticatedCall('TestCase.remove_tag', [testCaseId, tag]);
}
/**
* Add a component to test case
*/
async addComponent(testCaseId, componentId) {
return await this.client.authenticatedCall('TestCase.add_component', [testCaseId, componentId]);
}
/**
* Remove a component from test case
*/
async removeComponent(testCaseId, componentId) {
await this.client.authenticatedCall('TestCase.remove_component', [testCaseId, componentId]);
}
/**
* Add an attachment to test case
*/
async addAttachment(testCaseId, filename, b64content) {
return await this.client.authenticatedCall('TestCase.add_attachment', [testCaseId, filename, b64content]);
}
/**
* List attachments for test case
*/
async listAttachments(testCaseId) {
return await this.client.authenticatedCall('TestCase.list_attachments', [testCaseId]);
}
/**
* Get attachments for test case (alias for listAttachments method)
*/
async getAttachments(testCaseId) {
return this.listAttachments(testCaseId);
}
}
exports.TestCaseAPI = TestCaseAPI;
//# sourceMappingURL=testcase.js.map