edsger 0.45.0 → 0.45.1
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 +3 -3
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +3 -9
- package/dist/api/__tests__/app-store.test.d.ts +0 -7
- package/dist/api/__tests__/app-store.test.js +0 -60
- package/dist/api/__tests__/intelligence.test.d.ts +0 -11
- package/dist/api/__tests__/intelligence.test.js +0 -315
- package/dist/api/features/__tests__/feature-utils.test.d.ts +0 -4
- package/dist/api/features/__tests__/feature-utils.test.js +0 -370
- package/dist/api/features/__tests__/status-updater.test.d.ts +0 -4
- package/dist/api/features/__tests__/status-updater.test.js +0 -88
- package/dist/commands/build/__tests__/build.test.d.ts +0 -5
- package/dist/commands/build/__tests__/build.test.js +0 -206
- package/dist/commands/build/__tests__/detect-project.test.d.ts +0 -6
- package/dist/commands/build/__tests__/detect-project.test.js +0 -160
- package/dist/commands/build/__tests__/run-build.test.d.ts +0 -6
- package/dist/commands/build/__tests__/run-build.test.js +0 -433
- package/dist/commands/intelligence/__tests__/command.test.d.ts +0 -4
- package/dist/commands/intelligence/__tests__/command.test.js +0 -48
- package/dist/commands/workflow/core/__tests__/feature-filter.test.d.ts +0 -5
- package/dist/commands/workflow/core/__tests__/feature-filter.test.js +0 -316
- package/dist/commands/workflow/core/__tests__/pipeline-evaluator.test.d.ts +0 -4
- package/dist/commands/workflow/core/__tests__/pipeline-evaluator.test.js +0 -397
- package/dist/commands/workflow/core/__tests__/state-manager.test.d.ts +0 -4
- package/dist/commands/workflow/core/__tests__/state-manager.test.js +0 -384
- package/dist/config/__tests__/config.test.d.ts +0 -4
- package/dist/config/__tests__/config.test.js +0 -286
- package/dist/config/__tests__/feature-status.test.d.ts +0 -4
- package/dist/config/__tests__/feature-status.test.js +0 -111
- package/dist/errors/__tests__/index.test.d.ts +0 -4
- package/dist/errors/__tests__/index.test.js +0 -349
- package/dist/phases/app-store-generation/__tests__/agent.test.d.ts +0 -5
- package/dist/phases/app-store-generation/__tests__/agent.test.js +0 -142
- package/dist/phases/app-store-generation/__tests__/context.test.d.ts +0 -4
- package/dist/phases/app-store-generation/__tests__/context.test.js +0 -284
- package/dist/phases/app-store-generation/__tests__/prompts.test.d.ts +0 -4
- package/dist/phases/app-store-generation/__tests__/prompts.test.js +0 -122
- package/dist/phases/app-store-generation/__tests__/screenshot-composer.test.d.ts +0 -5
- package/dist/phases/app-store-generation/__tests__/screenshot-composer.test.js +0 -826
- package/dist/phases/code-review/__tests__/diff-utils.test.d.ts +0 -1
- package/dist/phases/code-review/__tests__/diff-utils.test.js +0 -101
- package/dist/phases/intelligence-analysis/__tests__/context.test.d.ts +0 -4
- package/dist/phases/intelligence-analysis/__tests__/context.test.js +0 -192
- package/dist/phases/intelligence-analysis/__tests__/matching.test.d.ts +0 -13
- package/dist/phases/intelligence-analysis/__tests__/matching.test.js +0 -154
- package/dist/phases/intelligence-analysis/__tests__/orchestration.test.d.ts +0 -5
- package/dist/phases/intelligence-analysis/__tests__/orchestration.test.js +0 -378
- package/dist/phases/intelligence-analysis/__tests__/prompts.test.d.ts +0 -4
- package/dist/phases/intelligence-analysis/__tests__/prompts.test.js +0 -33
- package/dist/phases/pr-execution/__tests__/file-assigner.test.d.ts +0 -1
- package/dist/phases/pr-execution/__tests__/file-assigner.test.js +0 -303
- package/dist/phases/pr-resolve/__tests__/checklist-learner.test.d.ts +0 -1
- package/dist/phases/pr-resolve/__tests__/checklist-learner.test.js +0 -157
- package/dist/phases/pr-resolve/__tests__/prompts.test.d.ts +0 -1
- package/dist/phases/pr-resolve/__tests__/prompts.test.js +0 -116
- package/dist/phases/pr-resolve/__tests__/resolve-mapping.test.d.ts +0 -1
- package/dist/phases/pr-resolve/__tests__/resolve-mapping.test.js +0 -138
- package/dist/phases/pr-resolve/__tests__/types.test.d.ts +0 -1
- package/dist/phases/pr-resolve/__tests__/types.test.js +0 -43
- package/dist/phases/pr-resolve/__tests__/workspace.test.d.ts +0 -1
- package/dist/phases/pr-resolve/__tests__/workspace.test.js +0 -111
- package/dist/phases/pr-review/__tests__/prompts.test.d.ts +0 -1
- package/dist/phases/pr-review/__tests__/prompts.test.js +0 -49
- package/dist/phases/pr-review/__tests__/review-comments.test.d.ts +0 -1
- package/dist/phases/pr-review/__tests__/review-comments.test.js +0 -110
- package/dist/phases/pr-shared/__tests__/agent-utils.test.d.ts +0 -1
- package/dist/phases/pr-shared/__tests__/agent-utils.test.js +0 -91
- package/dist/phases/pr-shared/__tests__/context.test.d.ts +0 -1
- package/dist/phases/pr-shared/__tests__/context.test.js +0 -94
- package/dist/phases/pr-splitting/__tests__/import-dep-validator.test.d.ts +0 -1
- package/dist/phases/pr-splitting/__tests__/import-dep-validator.test.js +0 -331
- package/dist/phases/release-sync/__tests__/github.test.d.ts +0 -9
- package/dist/phases/release-sync/__tests__/github.test.js +0 -123
- package/dist/phases/release-sync/__tests__/snapshot.test.d.ts +0 -8
- package/dist/phases/release-sync/__tests__/snapshot.test.js +0 -93
- package/dist/phases/smoke-test/__tests__/agent.test.d.ts +0 -4
- package/dist/phases/smoke-test/__tests__/agent.test.js +0 -85
- package/dist/services/coaching/__tests__/coaching-agent.test.d.ts +0 -1
- package/dist/services/coaching/__tests__/coaching-agent.test.js +0 -74
- package/dist/services/coaching/__tests__/coaching-loop.test.d.ts +0 -1
- package/dist/services/coaching/__tests__/coaching-loop.test.js +0 -59
- package/dist/services/coaching/__tests__/self-rating.test.d.ts +0 -1
- package/dist/services/coaching/__tests__/self-rating.test.js +0 -188
- package/dist/services/phase-hooks/__tests__/bindings-fetcher.test.d.ts +0 -1
- package/dist/services/phase-hooks/__tests__/bindings-fetcher.test.js +0 -122
- package/dist/services/phase-hooks/__tests__/hook-executor.test.d.ts +0 -1
- package/dist/services/phase-hooks/__tests__/hook-executor.test.js +0 -321
- package/dist/services/phase-hooks/__tests__/hook-runner.test.d.ts +0 -1
- package/dist/services/phase-hooks/__tests__/hook-runner.test.js +0 -261
- package/dist/services/phase-hooks/__tests__/plugin-loader.test.d.ts +0 -1
- package/dist/services/phase-hooks/__tests__/plugin-loader.test.js +0 -158
- package/dist/services/video/__tests__/video-pipeline.test.d.ts +0 -6
- package/dist/services/video/__tests__/video-pipeline.test.js +0 -249
- package/dist/workspace/__tests__/workspace-manager.test.d.ts +0 -7
- package/dist/workspace/__tests__/workspace-manager.test.js +0 -52
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for feature-filter module
|
|
3
|
-
* Pure functions for filtering and selecting features for processing
|
|
4
|
-
*/
|
|
5
|
-
import assert from 'node:assert';
|
|
6
|
-
import { describe, it } from 'node:test';
|
|
7
|
-
import { filterAvailableFeatures, filterCompletedFeatures, filterFailedFeatures, filterProcessingFeatures, findNextFeature, hasReachedMaxRetries, isFeatureCompleted, isFeatureFailed, isFeatureProcessing, shouldProcessFeature, } from '../feature-filter.js';
|
|
8
|
-
// ---- Helpers ----
|
|
9
|
-
function makeFeature(overrides = {}) {
|
|
10
|
-
return {
|
|
11
|
-
id: 'feat-1',
|
|
12
|
-
name: 'Test Feature',
|
|
13
|
-
status: 'ready_for_ai',
|
|
14
|
-
product_id: 'prod-1',
|
|
15
|
-
...overrides,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function makeState(overrides = {}) {
|
|
19
|
-
return {
|
|
20
|
-
featureId: 'feat-1',
|
|
21
|
-
retryCount: 0,
|
|
22
|
-
lastAttempt: new Date('2025-01-01T00:00:00Z'),
|
|
23
|
-
status: 'processing',
|
|
24
|
-
...overrides,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function makeStates(...entries) {
|
|
28
|
-
const map = new Map();
|
|
29
|
-
for (const entry of entries) {
|
|
30
|
-
map.set(entry.featureId, entry);
|
|
31
|
-
}
|
|
32
|
-
return map;
|
|
33
|
-
}
|
|
34
|
-
// ---- shouldProcessFeature ----
|
|
35
|
-
void describe('shouldProcessFeature', () => {
|
|
36
|
-
const maxRetries = 3;
|
|
37
|
-
const check = shouldProcessFeature(maxRetries);
|
|
38
|
-
void it('should return true when feature has never been processed', () => {
|
|
39
|
-
const feature = makeFeature();
|
|
40
|
-
const states = makeStates();
|
|
41
|
-
assert.strictEqual(check(feature, states), true);
|
|
42
|
-
});
|
|
43
|
-
void it('should return false when feature is completed', () => {
|
|
44
|
-
const feature = makeFeature();
|
|
45
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'completed' }));
|
|
46
|
-
assert.strictEqual(check(feature, states), false);
|
|
47
|
-
});
|
|
48
|
-
void it('should return false when feature is currently processing', () => {
|
|
49
|
-
const feature = makeFeature();
|
|
50
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'processing' }));
|
|
51
|
-
assert.strictEqual(check(feature, states), false);
|
|
52
|
-
});
|
|
53
|
-
void it('should return true when feature failed and retries are within limit', () => {
|
|
54
|
-
const feature = makeFeature();
|
|
55
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'failed', retryCount: 2 }));
|
|
56
|
-
assert.strictEqual(check(feature, states), true);
|
|
57
|
-
});
|
|
58
|
-
void it('should return false when feature failed and retries exceed limit', () => {
|
|
59
|
-
const feature = makeFeature();
|
|
60
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'failed', retryCount: 3 }));
|
|
61
|
-
assert.strictEqual(check(feature, states), false);
|
|
62
|
-
});
|
|
63
|
-
void it('should return false when feature failed and retries are above limit', () => {
|
|
64
|
-
const feature = makeFeature();
|
|
65
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'failed', retryCount: 5 }));
|
|
66
|
-
assert.strictEqual(check(feature, states), false);
|
|
67
|
-
});
|
|
68
|
-
void it('should return true when feature was updated after last attempt', () => {
|
|
69
|
-
const feature = makeFeature({
|
|
70
|
-
updated_at: '2025-06-01T00:00:00Z',
|
|
71
|
-
});
|
|
72
|
-
const states = makeStates(makeState({
|
|
73
|
-
featureId: 'feat-1',
|
|
74
|
-
status: 'completed',
|
|
75
|
-
lastAttempt: new Date('2025-01-01T00:00:00Z'),
|
|
76
|
-
}));
|
|
77
|
-
assert.strictEqual(check(feature, states), true);
|
|
78
|
-
});
|
|
79
|
-
void it('should return false when feature was updated before last attempt and is completed', () => {
|
|
80
|
-
const feature = makeFeature({
|
|
81
|
-
updated_at: '2024-01-01T00:00:00Z',
|
|
82
|
-
});
|
|
83
|
-
const states = makeStates(makeState({
|
|
84
|
-
featureId: 'feat-1',
|
|
85
|
-
status: 'completed',
|
|
86
|
-
lastAttempt: new Date('2025-01-01T00:00:00Z'),
|
|
87
|
-
}));
|
|
88
|
-
assert.strictEqual(check(feature, states), false);
|
|
89
|
-
});
|
|
90
|
-
void it('should return true when feature has no updated_at, was never processed', () => {
|
|
91
|
-
const feature = makeFeature({ updated_at: undefined });
|
|
92
|
-
const states = makeStates();
|
|
93
|
-
assert.strictEqual(check(feature, states), true);
|
|
94
|
-
});
|
|
95
|
-
void it('should return false when feature has no updated_at and is completed', () => {
|
|
96
|
-
const feature = makeFeature({ updated_at: undefined });
|
|
97
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'completed' }));
|
|
98
|
-
assert.strictEqual(check(feature, states), false);
|
|
99
|
-
});
|
|
100
|
-
void it('should use the provided maxRetries value', () => {
|
|
101
|
-
const strictCheck = shouldProcessFeature(0);
|
|
102
|
-
const feature = makeFeature();
|
|
103
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'failed', retryCount: 0 }));
|
|
104
|
-
assert.strictEqual(strictCheck(feature, states), false);
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
// ---- findNextFeature ----
|
|
108
|
-
void describe('findNextFeature', () => {
|
|
109
|
-
const maxRetries = 3;
|
|
110
|
-
void it('should return undefined for an empty feature list', () => {
|
|
111
|
-
const result = findNextFeature([], makeStates(), maxRetries);
|
|
112
|
-
assert.strictEqual(result, undefined);
|
|
113
|
-
});
|
|
114
|
-
void it('should return undefined when all features are completed', () => {
|
|
115
|
-
const features = [makeFeature({ id: 'a' }), makeFeature({ id: 'b' })];
|
|
116
|
-
const states = makeStates(makeState({ featureId: 'a', status: 'completed' }), makeState({ featureId: 'b', status: 'completed' }));
|
|
117
|
-
const result = findNextFeature(features, states, maxRetries);
|
|
118
|
-
assert.strictEqual(result, undefined);
|
|
119
|
-
});
|
|
120
|
-
void it('should return the first available feature', () => {
|
|
121
|
-
const features = [
|
|
122
|
-
makeFeature({ id: 'a' }),
|
|
123
|
-
makeFeature({ id: 'b' }),
|
|
124
|
-
makeFeature({ id: 'c' }),
|
|
125
|
-
];
|
|
126
|
-
const states = makeStates(makeState({ featureId: 'a', status: 'completed' }));
|
|
127
|
-
const result = findNextFeature(features, states, maxRetries);
|
|
128
|
-
assert.strictEqual(result?.id, 'b');
|
|
129
|
-
});
|
|
130
|
-
void it('should return a failed feature that can be retried', () => {
|
|
131
|
-
const features = [makeFeature({ id: 'a' })];
|
|
132
|
-
const states = makeStates(makeState({ featureId: 'a', status: 'failed', retryCount: 1 }));
|
|
133
|
-
const result = findNextFeature(features, states, maxRetries);
|
|
134
|
-
assert.strictEqual(result?.id, 'a');
|
|
135
|
-
});
|
|
136
|
-
void it('should skip processing features and find next available', () => {
|
|
137
|
-
const features = [makeFeature({ id: 'a' }), makeFeature({ id: 'b' })];
|
|
138
|
-
const states = makeStates(makeState({ featureId: 'a', status: 'processing' }));
|
|
139
|
-
const result = findNextFeature(features, states, maxRetries);
|
|
140
|
-
assert.strictEqual(result?.id, 'b');
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
// ---- isFeatureProcessing ----
|
|
144
|
-
void describe('isFeatureProcessing', () => {
|
|
145
|
-
void it('should return true when feature status is processing', () => {
|
|
146
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'processing' }));
|
|
147
|
-
assert.strictEqual(isFeatureProcessing('feat-1', states), true);
|
|
148
|
-
});
|
|
149
|
-
void it('should return false when feature status is completed', () => {
|
|
150
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'completed' }));
|
|
151
|
-
assert.strictEqual(isFeatureProcessing('feat-1', states), false);
|
|
152
|
-
});
|
|
153
|
-
void it('should return false when feature status is failed', () => {
|
|
154
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'failed' }));
|
|
155
|
-
assert.strictEqual(isFeatureProcessing('feat-1', states), false);
|
|
156
|
-
});
|
|
157
|
-
void it('should return false when feature is not in states', () => {
|
|
158
|
-
const states = makeStates();
|
|
159
|
-
assert.strictEqual(isFeatureProcessing('unknown', states), false);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
// ---- isFeatureCompleted ----
|
|
163
|
-
void describe('isFeatureCompleted', () => {
|
|
164
|
-
void it('should return true when feature status is completed', () => {
|
|
165
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'completed' }));
|
|
166
|
-
assert.strictEqual(isFeatureCompleted('feat-1', states), true);
|
|
167
|
-
});
|
|
168
|
-
void it('should return false when feature status is processing', () => {
|
|
169
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'processing' }));
|
|
170
|
-
assert.strictEqual(isFeatureCompleted('feat-1', states), false);
|
|
171
|
-
});
|
|
172
|
-
void it('should return false when feature is not in states', () => {
|
|
173
|
-
const states = makeStates();
|
|
174
|
-
assert.strictEqual(isFeatureCompleted('unknown', states), false);
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
// ---- isFeatureFailed ----
|
|
178
|
-
void describe('isFeatureFailed', () => {
|
|
179
|
-
void it('should return true when feature status is failed', () => {
|
|
180
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'failed' }));
|
|
181
|
-
assert.strictEqual(isFeatureFailed('feat-1', states), true);
|
|
182
|
-
});
|
|
183
|
-
void it('should return false when feature status is processing', () => {
|
|
184
|
-
const states = makeStates(makeState({ featureId: 'feat-1', status: 'processing' }));
|
|
185
|
-
assert.strictEqual(isFeatureFailed('feat-1', states), false);
|
|
186
|
-
});
|
|
187
|
-
void it('should return false when feature is not in states', () => {
|
|
188
|
-
const states = makeStates();
|
|
189
|
-
assert.strictEqual(isFeatureFailed('unknown', states), false);
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
// ---- hasReachedMaxRetries ----
|
|
193
|
-
void describe('hasReachedMaxRetries', () => {
|
|
194
|
-
void it('should return true when retryCount equals maxRetries', () => {
|
|
195
|
-
const states = makeStates(makeState({ featureId: 'feat-1', retryCount: 3 }));
|
|
196
|
-
assert.strictEqual(hasReachedMaxRetries('feat-1', states, 3), true);
|
|
197
|
-
});
|
|
198
|
-
void it('should return true when retryCount exceeds maxRetries', () => {
|
|
199
|
-
const states = makeStates(makeState({ featureId: 'feat-1', retryCount: 5 }));
|
|
200
|
-
assert.strictEqual(hasReachedMaxRetries('feat-1', states, 3), true);
|
|
201
|
-
});
|
|
202
|
-
void it('should return false when retryCount is below maxRetries', () => {
|
|
203
|
-
const states = makeStates(makeState({ featureId: 'feat-1', retryCount: 1 }));
|
|
204
|
-
assert.strictEqual(hasReachedMaxRetries('feat-1', states, 3), false);
|
|
205
|
-
});
|
|
206
|
-
void it('should return false when feature is not in states', () => {
|
|
207
|
-
const states = makeStates();
|
|
208
|
-
assert.strictEqual(hasReachedMaxRetries('unknown', states, 3), false);
|
|
209
|
-
});
|
|
210
|
-
void it('should return true when maxRetries is 0 and retryCount is 0', () => {
|
|
211
|
-
const states = makeStates(makeState({ featureId: 'feat-1', retryCount: 0 }));
|
|
212
|
-
assert.strictEqual(hasReachedMaxRetries('feat-1', states, 0), true);
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
// ---- filterProcessingFeatures ----
|
|
216
|
-
void describe('filterProcessingFeatures', () => {
|
|
217
|
-
void it('should return empty array for empty feature list', () => {
|
|
218
|
-
const result = filterProcessingFeatures([], makeStates());
|
|
219
|
-
assert.deepStrictEqual(result, []);
|
|
220
|
-
});
|
|
221
|
-
void it('should return only processing features', () => {
|
|
222
|
-
const features = [
|
|
223
|
-
makeFeature({ id: 'a' }),
|
|
224
|
-
makeFeature({ id: 'b' }),
|
|
225
|
-
makeFeature({ id: 'c' }),
|
|
226
|
-
];
|
|
227
|
-
const states = makeStates(makeState({ featureId: 'a', status: 'processing' }), makeState({ featureId: 'b', status: 'completed' }), makeState({ featureId: 'c', status: 'processing' }));
|
|
228
|
-
const result = filterProcessingFeatures(features, states);
|
|
229
|
-
assert.strictEqual(result.length, 2);
|
|
230
|
-
assert.strictEqual(result[0].id, 'a');
|
|
231
|
-
assert.strictEqual(result[1].id, 'c');
|
|
232
|
-
});
|
|
233
|
-
void it('should return empty array when no features are processing', () => {
|
|
234
|
-
const features = [makeFeature({ id: 'a' })];
|
|
235
|
-
const states = makeStates(makeState({ featureId: 'a', status: 'completed' }));
|
|
236
|
-
const result = filterProcessingFeatures(features, states);
|
|
237
|
-
assert.deepStrictEqual(result, []);
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
// ---- filterCompletedFeatures ----
|
|
241
|
-
void describe('filterCompletedFeatures', () => {
|
|
242
|
-
void it('should return empty array for empty feature list', () => {
|
|
243
|
-
const result = filterCompletedFeatures([], makeStates());
|
|
244
|
-
assert.deepStrictEqual(result, []);
|
|
245
|
-
});
|
|
246
|
-
void it('should return only completed features', () => {
|
|
247
|
-
const features = [
|
|
248
|
-
makeFeature({ id: 'a' }),
|
|
249
|
-
makeFeature({ id: 'b' }),
|
|
250
|
-
makeFeature({ id: 'c' }),
|
|
251
|
-
];
|
|
252
|
-
const states = makeStates(makeState({ featureId: 'a', status: 'completed' }), makeState({ featureId: 'b', status: 'failed' }), makeState({ featureId: 'c', status: 'completed' }));
|
|
253
|
-
const result = filterCompletedFeatures(features, states);
|
|
254
|
-
assert.strictEqual(result.length, 2);
|
|
255
|
-
assert.strictEqual(result[0].id, 'a');
|
|
256
|
-
assert.strictEqual(result[1].id, 'c');
|
|
257
|
-
});
|
|
258
|
-
});
|
|
259
|
-
// ---- filterFailedFeatures ----
|
|
260
|
-
void describe('filterFailedFeatures', () => {
|
|
261
|
-
void it('should return empty array for empty feature list', () => {
|
|
262
|
-
const result = filterFailedFeatures([], makeStates());
|
|
263
|
-
assert.deepStrictEqual(result, []);
|
|
264
|
-
});
|
|
265
|
-
void it('should return only failed features', () => {
|
|
266
|
-
const features = [
|
|
267
|
-
makeFeature({ id: 'a' }),
|
|
268
|
-
makeFeature({ id: 'b' }),
|
|
269
|
-
makeFeature({ id: 'c' }),
|
|
270
|
-
];
|
|
271
|
-
const states = makeStates(makeState({ featureId: 'a', status: 'failed' }), makeState({ featureId: 'b', status: 'processing' }), makeState({ featureId: 'c', status: 'failed' }));
|
|
272
|
-
const result = filterFailedFeatures(features, states);
|
|
273
|
-
assert.strictEqual(result.length, 2);
|
|
274
|
-
assert.strictEqual(result[0].id, 'a');
|
|
275
|
-
assert.strictEqual(result[1].id, 'c');
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
// ---- filterAvailableFeatures ----
|
|
279
|
-
void describe('filterAvailableFeatures', () => {
|
|
280
|
-
const maxRetries = 3;
|
|
281
|
-
void it('should return empty array for empty feature list', () => {
|
|
282
|
-
const result = filterAvailableFeatures([], makeStates(), maxRetries);
|
|
283
|
-
assert.deepStrictEqual(result, []);
|
|
284
|
-
});
|
|
285
|
-
void it('should return features that have never been processed', () => {
|
|
286
|
-
const features = [makeFeature({ id: 'a' }), makeFeature({ id: 'b' })];
|
|
287
|
-
const states = makeStates();
|
|
288
|
-
const result = filterAvailableFeatures(features, states, maxRetries);
|
|
289
|
-
assert.strictEqual(result.length, 2);
|
|
290
|
-
});
|
|
291
|
-
void it('should include retryable failed features and exclude completed/processing', () => {
|
|
292
|
-
const features = [
|
|
293
|
-
makeFeature({ id: 'a' }),
|
|
294
|
-
makeFeature({ id: 'b' }),
|
|
295
|
-
makeFeature({ id: 'c' }),
|
|
296
|
-
makeFeature({ id: 'd' }),
|
|
297
|
-
];
|
|
298
|
-
const states = makeStates(makeState({ featureId: 'a', status: 'completed' }), makeState({ featureId: 'b', status: 'processing' }), makeState({ featureId: 'c', status: 'failed', retryCount: 1 }), makeState({ featureId: 'd', status: 'failed', retryCount: 5 }));
|
|
299
|
-
const result = filterAvailableFeatures(features, states, maxRetries);
|
|
300
|
-
assert.strictEqual(result.length, 1);
|
|
301
|
-
assert.strictEqual(result[0].id, 'c');
|
|
302
|
-
});
|
|
303
|
-
void it('should include features updated after last attempt regardless of status', () => {
|
|
304
|
-
const features = [
|
|
305
|
-
makeFeature({ id: 'a', updated_at: '2025-12-01T00:00:00Z' }),
|
|
306
|
-
];
|
|
307
|
-
const states = makeStates(makeState({
|
|
308
|
-
featureId: 'a',
|
|
309
|
-
status: 'completed',
|
|
310
|
-
lastAttempt: new Date('2025-01-01T00:00:00Z'),
|
|
311
|
-
}));
|
|
312
|
-
const result = filterAvailableFeatures(features, states, maxRetries);
|
|
313
|
-
assert.strictEqual(result.length, 1);
|
|
314
|
-
assert.strictEqual(result[0].id, 'a');
|
|
315
|
-
});
|
|
316
|
-
});
|