@aaronshaf/plane 0.1.7 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/cycles.ts +86 -63
- package/src/commands/intake.ts +64 -44
- package/src/commands/issue.ts +386 -301
- package/src/commands/issues.ts +58 -45
- package/src/commands/labels.ts +6 -2
- package/src/commands/modules.ts +108 -74
- package/src/commands/pages.ts +42 -30
- package/src/config.ts +1 -1
- package/src/output.ts +12 -9
- package/src/resolve.ts +17 -5
- package/tests/api.test.ts +12 -8
- package/tests/cycles-extended.test.ts +15 -15
- package/tests/intake.test.ts +12 -12
- package/tests/issue-activity.test.ts +8 -16
- package/tests/issue-commands.test.ts +212 -278
- package/tests/issue-comments-worklogs.test.ts +31 -38
- package/tests/issue-links.test.ts +20 -23
- package/tests/modules.test.ts +17 -23
- package/tests/output.test.ts +11 -0
- package/tests/pages.test.ts +8 -8
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
expect,
|
|
8
8
|
it,
|
|
9
9
|
} from "bun:test";
|
|
10
|
-
import { Effect } from "effect";
|
|
10
|
+
import { Effect, Option } from "effect";
|
|
11
11
|
import { http, HttpResponse } from "msw";
|
|
12
12
|
import { setupServer } from "msw/node";
|
|
13
13
|
import { _clearProjectCache } from "@/resolve";
|
|
@@ -87,14 +87,12 @@ afterEach(() => {
|
|
|
87
87
|
|
|
88
88
|
describe("issueCommentsList", () => {
|
|
89
89
|
it("lists comments with author and stripped HTML", async () => {
|
|
90
|
-
const {
|
|
90
|
+
const { issueCommentsListHandler } = await import("@/commands/issue");
|
|
91
91
|
const logs: string[] = [];
|
|
92
92
|
const orig = console.log;
|
|
93
93
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
94
94
|
try {
|
|
95
|
-
await Effect.runPromise(
|
|
96
|
-
(issueCommentsList as any).handler({ ref: "ACME-29" }),
|
|
97
|
-
);
|
|
95
|
+
await Effect.runPromise(issueCommentsListHandler({ ref: "ACME-29" }));
|
|
98
96
|
} finally {
|
|
99
97
|
console.log = orig;
|
|
100
98
|
}
|
|
@@ -112,14 +110,12 @@ describe("issueCommentsList", () => {
|
|
|
112
110
|
() => HttpResponse.json({ results: [] }),
|
|
113
111
|
),
|
|
114
112
|
);
|
|
115
|
-
const {
|
|
113
|
+
const { issueCommentsListHandler } = await import("@/commands/issue");
|
|
116
114
|
const logs: string[] = [];
|
|
117
115
|
const orig = console.log;
|
|
118
116
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
119
117
|
try {
|
|
120
|
-
await Effect.runPromise(
|
|
121
|
-
(issueCommentsList as any).handler({ ref: "ACME-29" }),
|
|
122
|
-
);
|
|
118
|
+
await Effect.runPromise(issueCommentsListHandler({ ref: "ACME-29" }));
|
|
123
119
|
} finally {
|
|
124
120
|
console.log = orig;
|
|
125
121
|
}
|
|
@@ -142,14 +138,12 @@ describe("issueCommentsList", () => {
|
|
|
142
138
|
}),
|
|
143
139
|
),
|
|
144
140
|
);
|
|
145
|
-
const {
|
|
141
|
+
const { issueCommentsListHandler } = await import("@/commands/issue");
|
|
146
142
|
const logs: string[] = [];
|
|
147
143
|
const orig = console.log;
|
|
148
144
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
149
145
|
try {
|
|
150
|
-
await Effect.runPromise(
|
|
151
|
-
(issueCommentsList as any).handler({ ref: "ACME-29" }),
|
|
152
|
-
);
|
|
146
|
+
await Effect.runPromise(issueCommentsListHandler({ ref: "ACME-29" }));
|
|
153
147
|
} finally {
|
|
154
148
|
console.log = orig;
|
|
155
149
|
}
|
|
@@ -173,13 +167,13 @@ describe("issueCommentUpdate", () => {
|
|
|
173
167
|
},
|
|
174
168
|
),
|
|
175
169
|
);
|
|
176
|
-
const {
|
|
170
|
+
const { issueCommentUpdateHandler } = await import("@/commands/issue");
|
|
177
171
|
const logs: string[] = [];
|
|
178
172
|
const orig = console.log;
|
|
179
173
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
180
174
|
try {
|
|
181
175
|
await Effect.runPromise(
|
|
182
|
-
(
|
|
176
|
+
issueCommentUpdateHandler({
|
|
183
177
|
ref: "ACME-29",
|
|
184
178
|
commentId: "c1",
|
|
185
179
|
text: "Updated text",
|
|
@@ -188,7 +182,9 @@ describe("issueCommentUpdate", () => {
|
|
|
188
182
|
} finally {
|
|
189
183
|
console.log = orig;
|
|
190
184
|
}
|
|
191
|
-
expect((patchedBody as
|
|
185
|
+
expect((patchedBody as { comment_html?: string }).comment_html).toContain(
|
|
186
|
+
"Updated text",
|
|
187
|
+
);
|
|
192
188
|
expect(logs.join("\n")).toContain("c1");
|
|
193
189
|
expect(logs.join("\n")).toContain("updated");
|
|
194
190
|
});
|
|
@@ -206,13 +202,13 @@ describe("issueCommentDelete", () => {
|
|
|
206
202
|
},
|
|
207
203
|
),
|
|
208
204
|
);
|
|
209
|
-
const {
|
|
205
|
+
const { issueCommentDeleteHandler } = await import("@/commands/issue");
|
|
210
206
|
const logs: string[] = [];
|
|
211
207
|
const orig = console.log;
|
|
212
208
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
213
209
|
try {
|
|
214
210
|
await Effect.runPromise(
|
|
215
|
-
(
|
|
211
|
+
issueCommentDeleteHandler({
|
|
216
212
|
ref: "ACME-29",
|
|
217
213
|
commentId: "c1",
|
|
218
214
|
}),
|
|
@@ -227,14 +223,12 @@ describe("issueCommentDelete", () => {
|
|
|
227
223
|
|
|
228
224
|
describe("issueWorklogsList", () => {
|
|
229
225
|
it("lists worklogs with hours", async () => {
|
|
230
|
-
const {
|
|
226
|
+
const { issueWorklogsListHandler } = await import("@/commands/issue");
|
|
231
227
|
const logs: string[] = [];
|
|
232
228
|
const orig = console.log;
|
|
233
229
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
234
230
|
try {
|
|
235
|
-
await Effect.runPromise(
|
|
236
|
-
(issueWorklogsList as any).handler({ ref: "ACME-29" }),
|
|
237
|
-
);
|
|
231
|
+
await Effect.runPromise(issueWorklogsListHandler({ ref: "ACME-29" }));
|
|
238
232
|
} finally {
|
|
239
233
|
console.log = orig;
|
|
240
234
|
}
|
|
@@ -252,14 +246,12 @@ describe("issueWorklogsList", () => {
|
|
|
252
246
|
() => HttpResponse.json({ results: [] }),
|
|
253
247
|
),
|
|
254
248
|
);
|
|
255
|
-
const {
|
|
249
|
+
const { issueWorklogsListHandler } = await import("@/commands/issue");
|
|
256
250
|
const logs: string[] = [];
|
|
257
251
|
const orig = console.log;
|
|
258
252
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
259
253
|
try {
|
|
260
|
-
await Effect.runPromise(
|
|
261
|
-
(issueWorklogsList as any).handler({ ref: "ACME-29" }),
|
|
262
|
-
);
|
|
254
|
+
await Effect.runPromise(issueWorklogsListHandler({ ref: "ACME-29" }));
|
|
263
255
|
} finally {
|
|
264
256
|
console.log = orig;
|
|
265
257
|
}
|
|
@@ -273,7 +265,7 @@ describe("issueWorklogsAdd", () => {
|
|
|
273
265
|
http.post(
|
|
274
266
|
`${BASE}/api/v1/workspaces/${WS}/projects/proj-acme/issues/i1/worklogs/`,
|
|
275
267
|
async ({ request }) => {
|
|
276
|
-
const body = (await request.json()) as
|
|
268
|
+
const body = (await request.json()) as { duration?: number };
|
|
277
269
|
return HttpResponse.json({
|
|
278
270
|
id: "w-new",
|
|
279
271
|
duration: body.duration,
|
|
@@ -282,16 +274,16 @@ describe("issueWorklogsAdd", () => {
|
|
|
282
274
|
},
|
|
283
275
|
),
|
|
284
276
|
);
|
|
285
|
-
const {
|
|
277
|
+
const { issueWorklogsAddHandler } = await import("@/commands/issue");
|
|
286
278
|
const logs: string[] = [];
|
|
287
279
|
const orig = console.log;
|
|
288
280
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
289
281
|
try {
|
|
290
282
|
await Effect.runPromise(
|
|
291
|
-
(
|
|
283
|
+
issueWorklogsAddHandler({
|
|
292
284
|
ref: "ACME-29",
|
|
293
285
|
duration: 60,
|
|
294
|
-
description:
|
|
286
|
+
description: Option.none(),
|
|
295
287
|
}),
|
|
296
288
|
);
|
|
297
289
|
} finally {
|
|
@@ -306,7 +298,10 @@ describe("issueWorklogsAdd", () => {
|
|
|
306
298
|
http.post(
|
|
307
299
|
`${BASE}/api/v1/workspaces/${WS}/projects/proj-acme/issues/i1/worklogs/`,
|
|
308
300
|
async ({ request }) => {
|
|
309
|
-
const body = (await request.json()) as
|
|
301
|
+
const body = (await request.json()) as {
|
|
302
|
+
duration?: number;
|
|
303
|
+
description?: string;
|
|
304
|
+
};
|
|
310
305
|
return HttpResponse.json({
|
|
311
306
|
id: "w-new2",
|
|
312
307
|
duration: body.duration,
|
|
@@ -316,16 +311,16 @@ describe("issueWorklogsAdd", () => {
|
|
|
316
311
|
},
|
|
317
312
|
),
|
|
318
313
|
);
|
|
319
|
-
const {
|
|
314
|
+
const { issueWorklogsAddHandler } = await import("@/commands/issue");
|
|
320
315
|
const logs: string[] = [];
|
|
321
316
|
const orig = console.log;
|
|
322
317
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
323
318
|
try {
|
|
324
319
|
await Effect.runPromise(
|
|
325
|
-
(
|
|
320
|
+
issueWorklogsAddHandler({
|
|
326
321
|
ref: "ACME-29",
|
|
327
322
|
duration: 30,
|
|
328
|
-
description:
|
|
323
|
+
description: Option.some("standup"),
|
|
329
324
|
}),
|
|
330
325
|
);
|
|
331
326
|
} finally {
|
|
@@ -346,14 +341,12 @@ describe("issueWorklogsAdd", () => {
|
|
|
346
341
|
}),
|
|
347
342
|
),
|
|
348
343
|
);
|
|
349
|
-
const {
|
|
344
|
+
const { issueWorklogsListHandler } = await import("@/commands/issue");
|
|
350
345
|
const logs: string[] = [];
|
|
351
346
|
const orig = console.log;
|
|
352
347
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
353
348
|
try {
|
|
354
|
-
await Effect.runPromise(
|
|
355
|
-
(issueWorklogsList as any).handler({ ref: "ACME-29" }),
|
|
356
|
-
);
|
|
349
|
+
await Effect.runPromise(issueWorklogsListHandler({ ref: "ACME-29" }));
|
|
357
350
|
} finally {
|
|
358
351
|
console.log = orig;
|
|
359
352
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
expect,
|
|
8
8
|
it,
|
|
9
9
|
} from "bun:test";
|
|
10
|
-
import { Effect } from "effect";
|
|
10
|
+
import { Effect, Option } from "effect";
|
|
11
11
|
import { http, HttpResponse } from "msw";
|
|
12
12
|
import { setupServer } from "msw/node";
|
|
13
13
|
import { _clearProjectCache } from "@/resolve";
|
|
@@ -74,15 +74,13 @@ afterEach(() => {
|
|
|
74
74
|
|
|
75
75
|
describe("issueLinkList", () => {
|
|
76
76
|
it("lists links for an issue", async () => {
|
|
77
|
-
const {
|
|
77
|
+
const { issueLinkListHandler } = await import("@/commands/issue");
|
|
78
78
|
const logs: string[] = [];
|
|
79
79
|
const orig = console.log;
|
|
80
80
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
81
81
|
|
|
82
82
|
try {
|
|
83
|
-
await Effect.runPromise(
|
|
84
|
-
(issueLinkList as any).handler({ ref: "ACME-29" }),
|
|
85
|
-
);
|
|
83
|
+
await Effect.runPromise(issueLinkListHandler({ ref: "ACME-29" }));
|
|
86
84
|
} finally {
|
|
87
85
|
console.log = orig;
|
|
88
86
|
}
|
|
@@ -94,15 +92,13 @@ describe("issueLinkList", () => {
|
|
|
94
92
|
});
|
|
95
93
|
|
|
96
94
|
it("shows '(no title)' for null title", async () => {
|
|
97
|
-
const {
|
|
95
|
+
const { issueLinkListHandler } = await import("@/commands/issue");
|
|
98
96
|
const logs: string[] = [];
|
|
99
97
|
const orig = console.log;
|
|
100
98
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
101
99
|
|
|
102
100
|
try {
|
|
103
|
-
await Effect.runPromise(
|
|
104
|
-
(issueLinkList as any).handler({ ref: "ACME-29" }),
|
|
105
|
-
);
|
|
101
|
+
await Effect.runPromise(issueLinkListHandler({ ref: "ACME-29" }));
|
|
106
102
|
} finally {
|
|
107
103
|
console.log = orig;
|
|
108
104
|
}
|
|
@@ -118,15 +114,13 @@ describe("issueLinkList", () => {
|
|
|
118
114
|
),
|
|
119
115
|
);
|
|
120
116
|
|
|
121
|
-
const {
|
|
117
|
+
const { issueLinkListHandler } = await import("@/commands/issue");
|
|
122
118
|
const logs: string[] = [];
|
|
123
119
|
const orig = console.log;
|
|
124
120
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
125
121
|
|
|
126
122
|
try {
|
|
127
|
-
await Effect.runPromise(
|
|
128
|
-
(issueLinkList as any).handler({ ref: "ACME-29" }),
|
|
129
|
-
);
|
|
123
|
+
await Effect.runPromise(issueLinkListHandler({ ref: "ACME-29" }));
|
|
130
124
|
} finally {
|
|
131
125
|
console.log = orig;
|
|
132
126
|
}
|
|
@@ -141,7 +135,7 @@ describe("issueLinkAdd", () => {
|
|
|
141
135
|
http.post(
|
|
142
136
|
`${BASE}/api/v1/workspaces/${WS}/projects/proj-acme/issues/i1/issue-links/`,
|
|
143
137
|
async ({ request }) => {
|
|
144
|
-
const body = (await request.json()) as
|
|
138
|
+
const body = (await request.json()) as { url?: string };
|
|
145
139
|
return HttpResponse.json({
|
|
146
140
|
id: "lnk-new",
|
|
147
141
|
url: body.url,
|
|
@@ -151,17 +145,17 @@ describe("issueLinkAdd", () => {
|
|
|
151
145
|
),
|
|
152
146
|
);
|
|
153
147
|
|
|
154
|
-
const {
|
|
148
|
+
const { issueLinkAddHandler } = await import("@/commands/issue");
|
|
155
149
|
const logs: string[] = [];
|
|
156
150
|
const orig = console.log;
|
|
157
151
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
158
152
|
|
|
159
153
|
try {
|
|
160
154
|
await Effect.runPromise(
|
|
161
|
-
(
|
|
155
|
+
issueLinkAddHandler({
|
|
162
156
|
ref: "ACME-29",
|
|
163
157
|
url: "https://example.com",
|
|
164
|
-
title:
|
|
158
|
+
title: Option.none(),
|
|
165
159
|
}),
|
|
166
160
|
);
|
|
167
161
|
} finally {
|
|
@@ -178,7 +172,10 @@ describe("issueLinkAdd", () => {
|
|
|
178
172
|
http.post(
|
|
179
173
|
`${BASE}/api/v1/workspaces/${WS}/projects/proj-acme/issues/i1/issue-links/`,
|
|
180
174
|
async ({ request }) => {
|
|
181
|
-
const body = (await request.json()) as
|
|
175
|
+
const body = (await request.json()) as {
|
|
176
|
+
url?: string;
|
|
177
|
+
title?: string;
|
|
178
|
+
};
|
|
182
179
|
return HttpResponse.json({
|
|
183
180
|
id: "lnk-new2",
|
|
184
181
|
title: body.title,
|
|
@@ -189,17 +186,17 @@ describe("issueLinkAdd", () => {
|
|
|
189
186
|
),
|
|
190
187
|
);
|
|
191
188
|
|
|
192
|
-
const {
|
|
189
|
+
const { issueLinkAddHandler } = await import("@/commands/issue");
|
|
193
190
|
const logs: string[] = [];
|
|
194
191
|
const orig = console.log;
|
|
195
192
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
196
193
|
|
|
197
194
|
try {
|
|
198
195
|
await Effect.runPromise(
|
|
199
|
-
(
|
|
196
|
+
issueLinkAddHandler({
|
|
200
197
|
ref: "ACME-29",
|
|
201
198
|
url: "https://docs.example.com",
|
|
202
|
-
title:
|
|
199
|
+
title: Option.some("Design doc"),
|
|
203
200
|
}),
|
|
204
201
|
);
|
|
205
202
|
} finally {
|
|
@@ -223,14 +220,14 @@ describe("issueLinkRemove", () => {
|
|
|
223
220
|
),
|
|
224
221
|
);
|
|
225
222
|
|
|
226
|
-
const {
|
|
223
|
+
const { issueLinkRemoveHandler } = await import("@/commands/issue");
|
|
227
224
|
const logs: string[] = [];
|
|
228
225
|
const orig = console.log;
|
|
229
226
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
230
227
|
|
|
231
228
|
try {
|
|
232
229
|
await Effect.runPromise(
|
|
233
|
-
(
|
|
230
|
+
issueLinkRemoveHandler({ ref: "ACME-29", linkId: "lnk1" }),
|
|
234
231
|
);
|
|
235
232
|
} finally {
|
|
236
233
|
console.log = orig;
|
package/tests/modules.test.ts
CHANGED
|
@@ -74,15 +74,13 @@ afterEach(() => {
|
|
|
74
74
|
|
|
75
75
|
describe("modulesList", () => {
|
|
76
76
|
it("lists modules for a project", async () => {
|
|
77
|
-
const {
|
|
77
|
+
const { modulesListHandler } = await import("@/commands/modules");
|
|
78
78
|
const logs: string[] = [];
|
|
79
79
|
const orig = console.log;
|
|
80
80
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
81
81
|
|
|
82
82
|
try {
|
|
83
|
-
await Effect.runPromise(
|
|
84
|
-
(modulesList as any).handler({ project: "ACME" }),
|
|
85
|
-
);
|
|
83
|
+
await Effect.runPromise(modulesListHandler({ project: "ACME" }));
|
|
86
84
|
} finally {
|
|
87
85
|
console.log = orig;
|
|
88
86
|
}
|
|
@@ -103,15 +101,13 @@ describe("modulesList", () => {
|
|
|
103
101
|
),
|
|
104
102
|
);
|
|
105
103
|
|
|
106
|
-
const {
|
|
104
|
+
const { modulesListHandler } = await import("@/commands/modules");
|
|
107
105
|
const logs: string[] = [];
|
|
108
106
|
const orig = console.log;
|
|
109
107
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
110
108
|
|
|
111
109
|
try {
|
|
112
|
-
await Effect.runPromise(
|
|
113
|
-
(modulesList as any).handler({ project: "ACME" }),
|
|
114
|
-
);
|
|
110
|
+
await Effect.runPromise(modulesListHandler({ project: "ACME" }));
|
|
115
111
|
} finally {
|
|
116
112
|
console.log = orig;
|
|
117
113
|
}
|
|
@@ -130,15 +126,13 @@ describe("modulesList", () => {
|
|
|
130
126
|
),
|
|
131
127
|
);
|
|
132
128
|
|
|
133
|
-
const {
|
|
129
|
+
const { modulesListHandler } = await import("@/commands/modules");
|
|
134
130
|
const logs: string[] = [];
|
|
135
131
|
const orig = console.log;
|
|
136
132
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
137
133
|
|
|
138
134
|
try {
|
|
139
|
-
await Effect.runPromise(
|
|
140
|
-
(modulesList as any).handler({ project: "ACME" }),
|
|
141
|
-
);
|
|
135
|
+
await Effect.runPromise(modulesListHandler({ project: "ACME" }));
|
|
142
136
|
} finally {
|
|
143
137
|
console.log = orig;
|
|
144
138
|
}
|
|
@@ -149,14 +143,14 @@ describe("modulesList", () => {
|
|
|
149
143
|
|
|
150
144
|
describe("moduleIssuesList", () => {
|
|
151
145
|
it("lists issues in a module with detail", async () => {
|
|
152
|
-
const {
|
|
146
|
+
const { moduleIssuesListHandler } = await import("@/commands/modules");
|
|
153
147
|
const logs: string[] = [];
|
|
154
148
|
const orig = console.log;
|
|
155
149
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
156
150
|
|
|
157
151
|
try {
|
|
158
152
|
await Effect.runPromise(
|
|
159
|
-
(
|
|
153
|
+
moduleIssuesListHandler({
|
|
160
154
|
project: "ACME",
|
|
161
155
|
moduleId: "mod1",
|
|
162
156
|
}),
|
|
@@ -180,14 +174,14 @@ describe("moduleIssuesList", () => {
|
|
|
180
174
|
),
|
|
181
175
|
);
|
|
182
176
|
|
|
183
|
-
const {
|
|
177
|
+
const { moduleIssuesListHandler } = await import("@/commands/modules");
|
|
184
178
|
const logs: string[] = [];
|
|
185
179
|
const orig = console.log;
|
|
186
180
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
187
181
|
|
|
188
182
|
try {
|
|
189
183
|
await Effect.runPromise(
|
|
190
|
-
(
|
|
184
|
+
moduleIssuesListHandler({
|
|
191
185
|
project: "ACME",
|
|
192
186
|
moduleId: "mod1",
|
|
193
187
|
}),
|
|
@@ -207,14 +201,14 @@ describe("moduleIssuesList", () => {
|
|
|
207
201
|
),
|
|
208
202
|
);
|
|
209
203
|
|
|
210
|
-
const {
|
|
204
|
+
const { moduleIssuesListHandler } = await import("@/commands/modules");
|
|
211
205
|
const logs: string[] = [];
|
|
212
206
|
const orig = console.log;
|
|
213
207
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
214
208
|
|
|
215
209
|
try {
|
|
216
210
|
await Effect.runPromise(
|
|
217
|
-
(
|
|
211
|
+
moduleIssuesListHandler({
|
|
218
212
|
project: "ACME",
|
|
219
213
|
moduleId: "mod1",
|
|
220
214
|
}),
|
|
@@ -240,14 +234,14 @@ describe("moduleIssuesAdd", () => {
|
|
|
240
234
|
),
|
|
241
235
|
);
|
|
242
236
|
|
|
243
|
-
const {
|
|
237
|
+
const { moduleIssuesAddHandler } = await import("@/commands/modules");
|
|
244
238
|
const logs: string[] = [];
|
|
245
239
|
const orig = console.log;
|
|
246
240
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
247
241
|
|
|
248
242
|
try {
|
|
249
243
|
await Effect.runPromise(
|
|
250
|
-
(
|
|
244
|
+
moduleIssuesAddHandler({
|
|
251
245
|
project: "ACME",
|
|
252
246
|
moduleId: "mod1",
|
|
253
247
|
ref: "ACME-29",
|
|
@@ -257,7 +251,7 @@ describe("moduleIssuesAdd", () => {
|
|
|
257
251
|
console.log = orig;
|
|
258
252
|
}
|
|
259
253
|
|
|
260
|
-
expect((postedBody as
|
|
254
|
+
expect((postedBody as { issues?: string[] }).issues).toContain("i1");
|
|
261
255
|
expect(logs.join("\n")).toContain("ACME-29");
|
|
262
256
|
expect(logs.join("\n")).toContain("mod1");
|
|
263
257
|
});
|
|
@@ -276,14 +270,14 @@ describe("moduleIssuesRemove", () => {
|
|
|
276
270
|
),
|
|
277
271
|
);
|
|
278
272
|
|
|
279
|
-
const {
|
|
273
|
+
const { moduleIssuesRemoveHandler } = await import("@/commands/modules");
|
|
280
274
|
const logs: string[] = [];
|
|
281
275
|
const orig = console.log;
|
|
282
276
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
283
277
|
|
|
284
278
|
try {
|
|
285
279
|
await Effect.runPromise(
|
|
286
|
-
(
|
|
280
|
+
moduleIssuesRemoveHandler({
|
|
287
281
|
project: "ACME",
|
|
288
282
|
moduleId: "mod1",
|
|
289
283
|
moduleIssueId: "mi1",
|
package/tests/output.test.ts
CHANGED
|
@@ -58,6 +58,17 @@ describe("toXml", () => {
|
|
|
58
58
|
expect(out).toContain("</tags>");
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
+
it("renders primitive array items as <item> text nodes", () => {
|
|
62
|
+
const out = toXml([{ id: "1", assignees: ["uuid-1", "uuid-2"] }]);
|
|
63
|
+
expect(out).toContain("<item>uuid-1</item>");
|
|
64
|
+
expect(out).toContain("<item>uuid-2</item>");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("escapes special chars in primitive array items", () => {
|
|
68
|
+
const out = toXml([{ id: "1", labels: ["a & b"] }]);
|
|
69
|
+
expect(out).toContain("<item>a & b</item>");
|
|
70
|
+
});
|
|
71
|
+
|
|
61
72
|
it("handles null values as empty string in attributes", () => {
|
|
62
73
|
const out = toXml([{ id: "1", color: null }]);
|
|
63
74
|
expect(out).toContain('color=""');
|
package/tests/pages.test.ts
CHANGED
|
@@ -66,12 +66,12 @@ afterEach(() => {
|
|
|
66
66
|
|
|
67
67
|
describe("pagesList", () => {
|
|
68
68
|
it("lists pages with updated date and name", async () => {
|
|
69
|
-
const {
|
|
69
|
+
const { pagesListHandler } = await import("@/commands/pages");
|
|
70
70
|
const logs: string[] = [];
|
|
71
71
|
const orig = console.log;
|
|
72
72
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
73
73
|
try {
|
|
74
|
-
await Effect.runPromise((
|
|
74
|
+
await Effect.runPromise(pagesListHandler({ project: "ACME" }));
|
|
75
75
|
} finally {
|
|
76
76
|
console.log = orig;
|
|
77
77
|
}
|
|
@@ -84,12 +84,12 @@ describe("pagesList", () => {
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
it("falls back to created_at when no updated_at", async () => {
|
|
87
|
-
const {
|
|
87
|
+
const { pagesListHandler } = await import("@/commands/pages");
|
|
88
88
|
const logs: string[] = [];
|
|
89
89
|
const orig = console.log;
|
|
90
90
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
91
91
|
try {
|
|
92
|
-
await Effect.runPromise((
|
|
92
|
+
await Effect.runPromise(pagesListHandler({ project: "ACME" }));
|
|
93
93
|
} finally {
|
|
94
94
|
console.log = orig;
|
|
95
95
|
}
|
|
@@ -104,12 +104,12 @@ describe("pagesList", () => {
|
|
|
104
104
|
() => HttpResponse.json({ results: [] }),
|
|
105
105
|
),
|
|
106
106
|
);
|
|
107
|
-
const {
|
|
107
|
+
const { pagesListHandler } = await import("@/commands/pages");
|
|
108
108
|
const logs: string[] = [];
|
|
109
109
|
const orig = console.log;
|
|
110
110
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
111
111
|
try {
|
|
112
|
-
await Effect.runPromise((
|
|
112
|
+
await Effect.runPromise(pagesListHandler({ project: "ACME" }));
|
|
113
113
|
} finally {
|
|
114
114
|
console.log = orig;
|
|
115
115
|
}
|
|
@@ -119,13 +119,13 @@ describe("pagesList", () => {
|
|
|
119
119
|
|
|
120
120
|
describe("pagesGet", () => {
|
|
121
121
|
it("prints full JSON for a page", async () => {
|
|
122
|
-
const {
|
|
122
|
+
const { pagesGetHandler } = await import("@/commands/pages");
|
|
123
123
|
const logs: string[] = [];
|
|
124
124
|
const orig = console.log;
|
|
125
125
|
console.log = (...args: unknown[]) => logs.push(args.join(" "));
|
|
126
126
|
try {
|
|
127
127
|
await Effect.runPromise(
|
|
128
|
-
(
|
|
128
|
+
pagesGetHandler({ project: "ACME", pageId: "pg1" }),
|
|
129
129
|
);
|
|
130
130
|
} finally {
|
|
131
131
|
console.log = orig;
|