-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-get-projects.js
More file actions
39 lines (33 loc) · 1.21 KB
/
test-get-projects.js
File metadata and controls
39 lines (33 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import dotenv from 'dotenv';
import { apiTool } from './tools/atlassian-jira-calica-postman-interview/jira-cloud-ap-is/get-projects.js';
// Load environment variables
dotenv.config();
async function testGetProjects() {
console.log('Testing get-projects functionality...\n');
try {
const result = await apiTool.function();
if (result.error) {
console.error('Error occurred:', result.error);
if (result.details) {
console.error('Details:', result.details);
}
} else {
console.log(`Successfully retrieved ${result.totalProjects} projects:\n`);
result.projects.forEach((project, index) => {
console.log(`${index + 1}. ${project.name}`);
console.log(` Key: ${project.key}`);
console.log(` ID: ${project.id}`);
console.log(` Type: ${project.projectTypeKey}`);
console.log(` Style: ${project.style}`);
if (project.lead) {
console.log(` Lead: ${project.lead.displayName} (${project.lead.accountId})`);
}
console.log(` Private: ${project.isPrivate}`);
console.log('');
});
}
} catch (error) {
console.error('Unexpected error:', error.message);
}
}
testGetProjects();