forked from devshift-stack/code-cloud-agents
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-integrations.js
More file actions
91 lines (77 loc) · 3.24 KB
/
Copy pathtest-integrations.js
File metadata and controls
91 lines (77 loc) · 3.24 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* Integration Test Script
* Tests all 3 integrations: GitHub, Slack, Linear
*/
import "dotenv/config";
import { createGitHubClient } from "./src/integrations/github/client.js";
import { createSlackClient } from "./src/integrations/slack/client.js";
import { createLinearClient } from "./src/integrations/linear/client.js";
console.log("🧪 Testing Integrations...\n");
// Test GitHub
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
console.log("📦 GITHUB");
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
const github = createGitHubClient();
const githubStatus = await github.getStatus();
if (githubStatus.connected) {
console.log("✅ GitHub connected");
console.log(` User: ${githubStatus.user}`);
// List repos
const repos = await github.listRepos();
if (repos.success && repos.repos) {
console.log(` Repos: ${repos.repos.length} found`);
console.log(
` Sample: ${repos.repos
.slice(0, 3)
.map((r) => r.name)
.join(", ")}`,
);
}
} else {
console.log(`❌ GitHub failed: ${githubStatus.error}`);
}
console.log("");
// Test Slack
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
console.log("💬 SLACK");
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
const slack = createSlackClient();
const slackStatus = await slack.getStatus();
if (slackStatus.connected) {
console.log("✅ Slack connected");
console.log(` Team: ${slackStatus.team}`);
console.log(` Bot: ${slackStatus.user}`);
// List channels
const channels = await slack.listChannels();
if (channels.success && channels.channels) {
console.log(` Channels: ${channels.channels.length} found`);
const memberChannels = channels.channels.filter((c) => c.isMember);
console.log(` Member of: ${memberChannels.length} channels`);
}
} else {
console.log(`❌ Slack failed: ${slackStatus.error}`);
}
console.log("");
// Test Linear
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
console.log("🎯 LINEAR");
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
const linear = createLinearClient();
const linearStatus = await linear.getStatus();
if (linearStatus.connected) {
console.log("✅ Linear connected");
console.log(` Organization: ${linearStatus.organization}`);
console.log(` User: ${linearStatus.user}`);
// List teams
const teams = await linear.listTeams();
if (teams.success && teams.teams) {
console.log(` Teams: ${teams.teams.length} found`);
console.log(` Names: ${teams.teams.map((t) => t.name).join(", ")}`);
}
} else {
console.log(`❌ Linear failed: ${linearStatus.error}`);
}
console.log("");
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
console.log("✅ All tests completed!");
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");