@task-mcp/shared 1.0.20 → 1.0.21

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.
Files changed (167) hide show
  1. package/package.json +1 -6
  2. package/dist/algorithms/critical-path.d.ts +0 -46
  3. package/dist/algorithms/critical-path.d.ts.map +0 -1
  4. package/dist/algorithms/critical-path.js +0 -320
  5. package/dist/algorithms/critical-path.js.map +0 -1
  6. package/dist/algorithms/critical-path.test.d.ts +0 -2
  7. package/dist/algorithms/critical-path.test.d.ts.map +0 -1
  8. package/dist/algorithms/critical-path.test.js +0 -194
  9. package/dist/algorithms/critical-path.test.js.map +0 -1
  10. package/dist/algorithms/dependency-integrity.d.ts +0 -81
  11. package/dist/algorithms/dependency-integrity.d.ts.map +0 -1
  12. package/dist/algorithms/dependency-integrity.js +0 -207
  13. package/dist/algorithms/dependency-integrity.js.map +0 -1
  14. package/dist/algorithms/dependency-integrity.test.d.ts +0 -2
  15. package/dist/algorithms/dependency-integrity.test.d.ts.map +0 -1
  16. package/dist/algorithms/dependency-integrity.test.js +0 -309
  17. package/dist/algorithms/dependency-integrity.test.js.map +0 -1
  18. package/dist/algorithms/index.d.ts +0 -5
  19. package/dist/algorithms/index.d.ts.map +0 -1
  20. package/dist/algorithms/index.js +0 -5
  21. package/dist/algorithms/index.js.map +0 -1
  22. package/dist/algorithms/tech-analysis.d.ts +0 -106
  23. package/dist/algorithms/tech-analysis.d.ts.map +0 -1
  24. package/dist/algorithms/tech-analysis.js +0 -344
  25. package/dist/algorithms/tech-analysis.js.map +0 -1
  26. package/dist/algorithms/tech-analysis.test.d.ts +0 -2
  27. package/dist/algorithms/tech-analysis.test.d.ts.map +0 -1
  28. package/dist/algorithms/tech-analysis.test.js +0 -338
  29. package/dist/algorithms/tech-analysis.test.js.map +0 -1
  30. package/dist/algorithms/topological-sort.d.ts +0 -41
  31. package/dist/algorithms/topological-sort.d.ts.map +0 -1
  32. package/dist/algorithms/topological-sort.js +0 -165
  33. package/dist/algorithms/topological-sort.js.map +0 -1
  34. package/dist/algorithms/topological-sort.test.d.ts +0 -2
  35. package/dist/algorithms/topological-sort.test.d.ts.map +0 -1
  36. package/dist/algorithms/topological-sort.test.js +0 -162
  37. package/dist/algorithms/topological-sort.test.js.map +0 -1
  38. package/dist/index.d.ts +0 -4
  39. package/dist/index.d.ts.map +0 -1
  40. package/dist/index.js +0 -7
  41. package/dist/index.js.map +0 -1
  42. package/dist/schemas/inbox.d.ts +0 -55
  43. package/dist/schemas/inbox.d.ts.map +0 -1
  44. package/dist/schemas/inbox.js +0 -25
  45. package/dist/schemas/inbox.js.map +0 -1
  46. package/dist/schemas/index.d.ts +0 -7
  47. package/dist/schemas/index.d.ts.map +0 -1
  48. package/dist/schemas/index.js +0 -17
  49. package/dist/schemas/index.js.map +0 -1
  50. package/dist/schemas/project.d.ts +0 -177
  51. package/dist/schemas/project.d.ts.map +0 -1
  52. package/dist/schemas/project.js +0 -56
  53. package/dist/schemas/project.js.map +0 -1
  54. package/dist/schemas/response-format.d.ts +0 -148
  55. package/dist/schemas/response-format.d.ts.map +0 -1
  56. package/dist/schemas/response-format.js +0 -18
  57. package/dist/schemas/response-format.js.map +0 -1
  58. package/dist/schemas/response-schema.d.ts +0 -307
  59. package/dist/schemas/response-schema.d.ts.map +0 -1
  60. package/dist/schemas/response-schema.js +0 -75
  61. package/dist/schemas/response-schema.js.map +0 -1
  62. package/dist/schemas/response-schema.test.d.ts +0 -2
  63. package/dist/schemas/response-schema.test.d.ts.map +0 -1
  64. package/dist/schemas/response-schema.test.js +0 -256
  65. package/dist/schemas/response-schema.test.js.map +0 -1
  66. package/dist/schemas/state.d.ts +0 -17
  67. package/dist/schemas/state.d.ts.map +0 -1
  68. package/dist/schemas/state.js +0 -17
  69. package/dist/schemas/state.js.map +0 -1
  70. package/dist/schemas/task.d.ts +0 -881
  71. package/dist/schemas/task.d.ts.map +0 -1
  72. package/dist/schemas/task.js +0 -189
  73. package/dist/schemas/task.js.map +0 -1
  74. package/dist/schemas/view.d.ts +0 -143
  75. package/dist/schemas/view.d.ts.map +0 -1
  76. package/dist/schemas/view.js +0 -48
  77. package/dist/schemas/view.js.map +0 -1
  78. package/dist/utils/dashboard-renderer.d.ts +0 -93
  79. package/dist/utils/dashboard-renderer.d.ts.map +0 -1
  80. package/dist/utils/dashboard-renderer.js +0 -424
  81. package/dist/utils/dashboard-renderer.js.map +0 -1
  82. package/dist/utils/dashboard-renderer.test.d.ts +0 -2
  83. package/dist/utils/dashboard-renderer.test.d.ts.map +0 -1
  84. package/dist/utils/dashboard-renderer.test.js +0 -774
  85. package/dist/utils/dashboard-renderer.test.js.map +0 -1
  86. package/dist/utils/date.d.ts +0 -94
  87. package/dist/utils/date.d.ts.map +0 -1
  88. package/dist/utils/date.js +0 -323
  89. package/dist/utils/date.js.map +0 -1
  90. package/dist/utils/date.test.d.ts +0 -2
  91. package/dist/utils/date.test.d.ts.map +0 -1
  92. package/dist/utils/date.test.js +0 -276
  93. package/dist/utils/date.test.js.map +0 -1
  94. package/dist/utils/hierarchy.d.ts +0 -102
  95. package/dist/utils/hierarchy.d.ts.map +0 -1
  96. package/dist/utils/hierarchy.js +0 -236
  97. package/dist/utils/hierarchy.js.map +0 -1
  98. package/dist/utils/hierarchy.test.d.ts +0 -2
  99. package/dist/utils/hierarchy.test.d.ts.map +0 -1
  100. package/dist/utils/hierarchy.test.js +0 -436
  101. package/dist/utils/hierarchy.test.js.map +0 -1
  102. package/dist/utils/id.d.ts +0 -60
  103. package/dist/utils/id.d.ts.map +0 -1
  104. package/dist/utils/id.js +0 -118
  105. package/dist/utils/id.js.map +0 -1
  106. package/dist/utils/id.test.d.ts +0 -2
  107. package/dist/utils/id.test.d.ts.map +0 -1
  108. package/dist/utils/id.test.js +0 -193
  109. package/dist/utils/id.test.js.map +0 -1
  110. package/dist/utils/index.d.ts +0 -12
  111. package/dist/utils/index.d.ts.map +0 -1
  112. package/dist/utils/index.js +0 -34
  113. package/dist/utils/index.js.map +0 -1
  114. package/dist/utils/natural-language.d.ts +0 -57
  115. package/dist/utils/natural-language.d.ts.map +0 -1
  116. package/dist/utils/natural-language.js +0 -211
  117. package/dist/utils/natural-language.js.map +0 -1
  118. package/dist/utils/natural-language.test.d.ts +0 -2
  119. package/dist/utils/natural-language.test.d.ts.map +0 -1
  120. package/dist/utils/natural-language.test.js +0 -197
  121. package/dist/utils/natural-language.test.js.map +0 -1
  122. package/dist/utils/priority-queue.d.ts +0 -17
  123. package/dist/utils/priority-queue.d.ts.map +0 -1
  124. package/dist/utils/priority-queue.js +0 -62
  125. package/dist/utils/priority-queue.js.map +0 -1
  126. package/dist/utils/priority-queue.test.d.ts +0 -2
  127. package/dist/utils/priority-queue.test.d.ts.map +0 -1
  128. package/dist/utils/priority-queue.test.js +0 -82
  129. package/dist/utils/priority-queue.test.js.map +0 -1
  130. package/dist/utils/projection.d.ts +0 -65
  131. package/dist/utils/projection.d.ts.map +0 -1
  132. package/dist/utils/projection.js +0 -180
  133. package/dist/utils/projection.js.map +0 -1
  134. package/dist/utils/projection.test.d.ts +0 -2
  135. package/dist/utils/projection.test.d.ts.map +0 -1
  136. package/dist/utils/projection.test.js +0 -336
  137. package/dist/utils/projection.test.js.map +0 -1
  138. package/dist/utils/terminal-ui.d.ts +0 -208
  139. package/dist/utils/terminal-ui.d.ts.map +0 -1
  140. package/dist/utils/terminal-ui.js +0 -611
  141. package/dist/utils/terminal-ui.js.map +0 -1
  142. package/dist/utils/terminal-ui.test.d.ts +0 -2
  143. package/dist/utils/terminal-ui.test.d.ts.map +0 -1
  144. package/dist/utils/terminal-ui.test.js +0 -683
  145. package/dist/utils/terminal-ui.test.js.map +0 -1
  146. package/dist/utils/workspace.d.ts +0 -100
  147. package/dist/utils/workspace.d.ts.map +0 -1
  148. package/dist/utils/workspace.js +0 -173
  149. package/dist/utils/workspace.js.map +0 -1
  150. package/dist/utils/workspace.test.d.ts +0 -2
  151. package/dist/utils/workspace.test.d.ts.map +0 -1
  152. package/dist/utils/workspace.test.js +0 -97
  153. package/dist/utils/workspace.test.js.map +0 -1
  154. package/src/algorithms/critical-path.test.ts +0 -241
  155. package/src/algorithms/dependency-integrity.test.ts +0 -348
  156. package/src/algorithms/tech-analysis.test.ts +0 -413
  157. package/src/algorithms/topological-sort.test.ts +0 -190
  158. package/src/schemas/response-schema.test.ts +0 -314
  159. package/src/utils/dashboard-renderer.test.ts +0 -983
  160. package/src/utils/date.test.ts +0 -329
  161. package/src/utils/hierarchy.test.ts +0 -505
  162. package/src/utils/id.test.ts +0 -235
  163. package/src/utils/natural-language.test.ts +0 -242
  164. package/src/utils/priority-queue.test.ts +0 -103
  165. package/src/utils/projection.test.ts +0 -425
  166. package/src/utils/terminal-ui.test.ts +0 -831
  167. package/src/utils/workspace.test.ts +0 -125
@@ -1,425 +0,0 @@
1
- import { describe, test, expect } from "bun:test";
2
- import {
3
- projectTask,
4
- projectTasks,
5
- projectTasksPaginated,
6
- projectInboxItem,
7
- projectInboxItems,
8
- formatResponse,
9
- applyPagination,
10
- truncate,
11
- summarizeList,
12
- } from "./projection.js";
13
- import type { Task } from "../schemas/task.js";
14
- import type { InboxItem } from "../schemas/inbox.js";
15
-
16
- // Test fixtures
17
- const createTask = (overrides: Partial<Task> = {}): Task => {
18
- const base: Task = {
19
- id: "task-1",
20
- workspace: "test-workspace",
21
- title: "Test Task",
22
- status: "pending",
23
- priority: "medium",
24
- createdAt: "2025-01-01T00:00:00.000Z",
25
- updatedAt: "2025-01-01T00:00:00.000Z",
26
- dueDate: "2025-01-15",
27
- tags: ["test", "unit"],
28
- contexts: ["work"],
29
- parentId: "parent-1",
30
- description: "This is a test task with a long description",
31
- estimate: { expected: 60, optimistic: 30, pessimistic: 120 },
32
- dependencies: [{ taskId: "dep-1", type: "blocked_by" }],
33
- };
34
- return { ...base, ...overrides };
35
- };
36
-
37
- const createInboxItem = (overrides: Partial<InboxItem> = {}): InboxItem => ({
38
- id: "inbox-1",
39
- content: "Quick idea for later",
40
- status: "pending",
41
- capturedAt: "2025-01-01T00:00:00.000Z",
42
- tags: ["idea"],
43
- source: "cli",
44
- ...overrides,
45
- });
46
-
47
- describe("projectTask", () => {
48
- test("concise format returns only 4 essential fields", () => {
49
- const task = createTask();
50
- const result = projectTask(task, "concise");
51
-
52
- expect(result).toEqual({
53
- id: "task-1",
54
- title: "Test Task",
55
- status: "pending",
56
- priority: "medium",
57
- });
58
- expect(Object.keys(result)).toHaveLength(4);
59
- });
60
-
61
- test("standard format returns 8 common fields", () => {
62
- const task = createTask();
63
- const result = projectTask(task, "standard");
64
-
65
- expect(result).toEqual({
66
- id: "task-1",
67
- title: "Test Task",
68
- status: "pending",
69
- priority: "medium",
70
- dueDate: "2025-01-15",
71
- tags: ["test", "unit"],
72
- contexts: ["work"],
73
- parentId: "parent-1",
74
- });
75
- });
76
-
77
- test("detailed format returns full task", () => {
78
- const task = createTask();
79
- const result = projectTask(task, "detailed");
80
-
81
- expect(result).toBe(task); // Same reference
82
- expect(result).toHaveProperty("description");
83
- expect(result).toHaveProperty("estimate");
84
- expect(result).toHaveProperty("dependencies");
85
- });
86
-
87
- test("concise format omits undefined optional fields", () => {
88
- // Create task without optional fields by deleting them
89
- const task = createTask();
90
- delete (task as Record<string, unknown>)["dueDate"];
91
- delete (task as Record<string, unknown>)["tags"];
92
- const result = projectTask(task, "concise");
93
-
94
- expect(result).not.toHaveProperty("dueDate");
95
- expect(result).not.toHaveProperty("tags");
96
- });
97
- });
98
-
99
- describe("projectTasks", () => {
100
- test("projects all tasks without limit", () => {
101
- const tasks = [createTask({ id: "t1" }), createTask({ id: "t2" }), createTask({ id: "t3" })];
102
- const result = projectTasks(tasks, "concise");
103
-
104
- expect(result).toHaveLength(3);
105
- expect(result[0]).toEqual({ id: "t1", title: "Test Task", status: "pending", priority: "medium" });
106
- });
107
-
108
- test("limits tasks when limit provided", () => {
109
- const tasks = [
110
- createTask({ id: "t1" }),
111
- createTask({ id: "t2" }),
112
- createTask({ id: "t3" }),
113
- createTask({ id: "t4" }),
114
- createTask({ id: "t5" }),
115
- ];
116
- const result = projectTasks(tasks, "concise", 2);
117
-
118
- expect(result).toHaveLength(2);
119
- expect(result.map((t) => t.id)).toEqual(["t1", "t2"]);
120
- });
121
-
122
- test("returns all tasks if limit exceeds length", () => {
123
- const tasks = [createTask({ id: "t1" }), createTask({ id: "t2" })];
124
- const result = projectTasks(tasks, "concise", 100);
125
-
126
- expect(result).toHaveLength(2);
127
- });
128
-
129
- test("returns empty array for empty input", () => {
130
- const result = projectTasks([], "concise");
131
- expect(result).toEqual([]);
132
- });
133
- });
134
-
135
- describe("projectTasksPaginated", () => {
136
- test("returns paginated response with correct metadata", () => {
137
- const tasks = Array.from({ length: 50 }, (_, i) => createTask({ id: `t${i}` }));
138
- const result = projectTasksPaginated(tasks, "concise", 10, 0);
139
-
140
- expect(result.items).toHaveLength(10);
141
- expect(result.total).toBe(50);
142
- expect(result.limit).toBe(10);
143
- expect(result.offset).toBe(0);
144
- expect(result.hasMore).toBe(true);
145
- });
146
-
147
- test("returns correct page with offset", () => {
148
- const tasks = Array.from({ length: 50 }, (_, i) => createTask({ id: `t${i}` }));
149
- const result = projectTasksPaginated(tasks, "concise", 10, 20);
150
-
151
- expect(result.items).toHaveLength(10);
152
- expect(result.items[0]?.id).toBe("t20");
153
- expect(result.offset).toBe(20);
154
- expect(result.hasMore).toBe(true);
155
- });
156
-
157
- test("hasMore is false on last page", () => {
158
- const tasks = Array.from({ length: 25 }, (_, i) => createTask({ id: `t${i}` }));
159
- const result = projectTasksPaginated(tasks, "concise", 10, 20);
160
-
161
- expect(result.items).toHaveLength(5);
162
- expect(result.hasMore).toBe(false);
163
- });
164
-
165
- test("enforces max limit of 100", () => {
166
- const tasks = Array.from({ length: 200 }, (_, i) => createTask({ id: `t${i}` }));
167
- const result = projectTasksPaginated(tasks, "concise", 150, 0);
168
-
169
- expect(result.items).toHaveLength(100);
170
- expect(result.limit).toBe(100);
171
- expect(result.hasMore).toBe(true);
172
- });
173
-
174
- test("uses default limit of 20", () => {
175
- const tasks = Array.from({ length: 50 }, (_, i) => createTask({ id: `t${i}` }));
176
- const result = projectTasksPaginated(tasks, "concise");
177
-
178
- expect(result.items).toHaveLength(20);
179
- expect(result.limit).toBe(20);
180
- });
181
- });
182
-
183
- describe("projectInboxItem", () => {
184
- test("concise format returns 3 essential fields", () => {
185
- const item = createInboxItem();
186
- const result = projectInboxItem(item, "concise");
187
-
188
- expect(result).toEqual({
189
- id: "inbox-1",
190
- content: "Quick idea for later",
191
- status: "pending",
192
- });
193
- expect(Object.keys(result)).toHaveLength(3);
194
- });
195
-
196
- test("standard format includes capturedAt and tags", () => {
197
- const item = createInboxItem();
198
- const result = projectInboxItem(item, "standard");
199
-
200
- expect(result).toEqual({
201
- id: "inbox-1",
202
- content: "Quick idea for later",
203
- status: "pending",
204
- capturedAt: "2025-01-01T00:00:00.000Z",
205
- tags: ["idea"],
206
- });
207
- });
208
-
209
- test("detailed format returns full item", () => {
210
- const item = createInboxItem();
211
- const result = projectInboxItem(item, "detailed");
212
-
213
- expect(result).toBe(item);
214
- expect(result).toHaveProperty("source");
215
- });
216
- });
217
-
218
- describe("projectInboxItems", () => {
219
- test("projects and limits inbox items", () => {
220
- const items = [
221
- createInboxItem({ id: "i1" }),
222
- createInboxItem({ id: "i2" }),
223
- createInboxItem({ id: "i3" }),
224
- ];
225
- const result = projectInboxItems(items, "concise", 2);
226
-
227
- expect(result).toHaveLength(2);
228
- expect(result.map((i) => i.id)).toEqual(["i1", "i2"]);
229
- });
230
- });
231
-
232
- describe("formatResponse", () => {
233
- test("returns JSON for concise format", () => {
234
- const data = { id: "1", name: "test" };
235
- const result = formatResponse(data, "concise");
236
-
237
- expect(result).toBe(JSON.stringify(data));
238
- });
239
-
240
- test("returns JSON for standard format", () => {
241
- const data = [{ id: "1" }, { id: "2" }];
242
- const result = formatResponse(data, "standard");
243
-
244
- expect(result).toBe(JSON.stringify(data));
245
- });
246
-
247
- test("uses detailedFormatter for detailed format", () => {
248
- const data = { id: "1", name: "test" };
249
- const formatter = (d: typeof data | (typeof data)[]) => {
250
- if (Array.isArray(d)) return d.map((i) => `${i.id}`).join(",");
251
- return `ID: ${d.id}, Name: ${d.name}`;
252
- };
253
- const result = formatResponse(data, "detailed", formatter);
254
-
255
- expect(result).toBe("ID: 1, Name: test");
256
- });
257
-
258
- test("falls back to JSON if no detailedFormatter provided", () => {
259
- const data = { id: "1" };
260
- const result = formatResponse(data, "detailed");
261
-
262
- expect(result).toBe(JSON.stringify(data));
263
- });
264
- });
265
-
266
- describe("applyPagination", () => {
267
- test("applies limit and offset correctly", () => {
268
- const items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
269
- const result = applyPagination(items, 3, 2);
270
-
271
- expect(result.items).toEqual([3, 4, 5]);
272
- expect(result.hasMore).toBe(true);
273
- expect(result.total).toBe(10);
274
- });
275
-
276
- test("enforces max limit of 100", () => {
277
- const items = Array.from({ length: 200 }, (_, i) => i);
278
- const result = applyPagination(items, 150);
279
-
280
- expect(result.items).toHaveLength(100);
281
- });
282
-
283
- test("enforces min limit of 1", () => {
284
- const items = [1, 2, 3];
285
- const result = applyPagination(items, 0);
286
-
287
- expect(result.items).toHaveLength(1);
288
- });
289
-
290
- test("handles negative offset as 0", () => {
291
- const items = [1, 2, 3];
292
- const result = applyPagination(items, 10, -5);
293
-
294
- expect(result.items).toEqual([1, 2, 3]);
295
- });
296
-
297
- test("uses default values", () => {
298
- const items = Array.from({ length: 50 }, (_, i) => i);
299
- const result = applyPagination(items);
300
-
301
- expect(result.items).toHaveLength(20);
302
- expect(result.items[0]).toBe(0);
303
- });
304
- });
305
-
306
- describe("truncate", () => {
307
- test("returns original string if under max length", () => {
308
- const result = truncate("short", 100);
309
- expect(result).toBe("short");
310
- });
311
-
312
- test("truncates and adds ellipsis", () => {
313
- const result = truncate("this is a very long string", 10);
314
- expect(result).toBe("this is...");
315
- expect(result.length).toBe(10);
316
- });
317
-
318
- test("uses default max length of 100", () => {
319
- const longString = "a".repeat(150);
320
- const result = truncate(longString);
321
-
322
- expect(result.length).toBe(100);
323
- expect(result.endsWith("...")).toBe(true);
324
- });
325
-
326
- test("handles empty string", () => {
327
- const result = truncate("");
328
- expect(result).toBe("");
329
- });
330
-
331
- test("handles string exactly at max length", () => {
332
- const str = "a".repeat(100);
333
- const result = truncate(str, 100);
334
-
335
- expect(result).toBe(str);
336
- });
337
- });
338
-
339
- describe("summarizeList", () => {
340
- test("returns displayed items and remaining count", () => {
341
- const items = [
342
- { id: "1", name: "A" },
343
- { id: "2", name: "B" },
344
- { id: "3", name: "C" },
345
- { id: "4", name: "D" },
346
- { id: "5", name: "E" },
347
- { id: "6", name: "F" },
348
- { id: "7", name: "G" },
349
- ];
350
-
351
- const result = summarizeList(items, 3, (i) => i.id);
352
-
353
- expect(result.displayed).toHaveLength(3);
354
- expect(result.remaining).toBe(4);
355
- expect(result.remainingIds).toEqual(["4", "5", "6", "7"]);
356
- });
357
-
358
- test("returns all items if under maxDisplay", () => {
359
- const items = [{ id: "1" }, { id: "2" }];
360
- const result = summarizeList(items, 5, (i) => i.id);
361
-
362
- expect(result.displayed).toHaveLength(2);
363
- expect(result.remaining).toBe(0);
364
- expect(result.remainingIds).toEqual([]);
365
- });
366
-
367
- test("uses default maxDisplay of 5", () => {
368
- const items = Array.from({ length: 10 }, (_, i) => ({ id: `${i}` }));
369
- const result = summarizeList(items, undefined, (i) => i.id);
370
-
371
- expect(result.displayed).toHaveLength(5);
372
- expect(result.remaining).toBe(5);
373
- });
374
-
375
- test("handles empty list", () => {
376
- const result = summarizeList([], 5, (i: { id: string }) => i.id);
377
-
378
- expect(result.displayed).toEqual([]);
379
- expect(result.remaining).toBe(0);
380
- expect(result.remainingIds).toEqual([]);
381
- });
382
- });
383
-
384
- // Token efficiency verification tests
385
- describe("token efficiency", () => {
386
- test("concise task is significantly smaller than full task", () => {
387
- const task = createTask({
388
- description: "A very long description ".repeat(10),
389
- estimate: { expected: 60, optimistic: 30, pessimistic: 120 },
390
- dependencies: [
391
- { taskId: "d1", type: "blocked_by" },
392
- { taskId: "d2", type: "blocked_by" },
393
- ],
394
- });
395
-
396
- const concise = projectTask(task, "concise");
397
- const full = projectTask(task, "detailed");
398
-
399
- const conciseSize = JSON.stringify(concise).length;
400
- const fullSize = JSON.stringify(full).length;
401
-
402
- // Concise should be at least 50% smaller
403
- expect(conciseSize).toBeLessThan(fullSize * 0.5);
404
- });
405
-
406
- test("concise list is significantly smaller than full list", () => {
407
- const tasks = Array.from({ length: 20 }, (_, i) =>
408
- createTask({
409
- id: `task-${i}`,
410
- title: `Task ${i}: Do something important`,
411
- description: "Detailed description of what needs to be done ".repeat(5),
412
- estimate: { expected: 60, optimistic: 30, pessimistic: 120 },
413
- })
414
- );
415
-
416
- const concise = projectTasks(tasks, "concise");
417
- const full = projectTasks(tasks, "detailed");
418
-
419
- const conciseSize = JSON.stringify(concise).length;
420
- const fullSize = JSON.stringify(full).length;
421
-
422
- // For list of 20 tasks, concise should be 70%+ smaller
423
- expect(conciseSize).toBeLessThan(fullSize * 0.4);
424
- });
425
- });