🔖 Checkpoint: Edit /workspaces/claude-code-flow/validation-test/tests/helpers/testHelpers.js

This commit is contained in:
rUv committed 2025-08-16 14:28:53 +00:00
1 parent 574ad7f6ba
commit 58039ff8ab
3 files changed
+53

No files matched your search

+1
View File
@@ -0,0 +1 @@
{"branch": "checkpoint/pre-edit-20250816-142848", "file": "/workspaces/claude-code-flow/validation-test/tests/fixtures/testData.js", "timestamp": "2025-08-16T14:28:48Z", "type": "pre-edit", "original_branch": "alpha90"}
+1
View File
@@ -0,0 +1 @@
{"tag": "checkpoint-20250816-142850", "file": "/workspaces/claude-code-flow/validation-test/tests/fixtures/testData.js", "timestamp": "2025-08-16T14:28:50Z", "type": "post-edit", "branch": "alpha90", "diff_summary": " .claude-flow/metrics/performance.json | 2 +- .claude-flow/metrics/system-metrics.json | 110 +++++++++++++---------------- .claude-flow/metrics/task-metrics.json | 6 +- .claude/checkpoints/task-1755354490.json | 1 + claude-flow-wiki | 0 validation-test/tests/fixtures/testData.js | 68 ++++++++++++++++++ 6 files changed, 122 insertions(+), 65 deletions(-) "}
@@ -0,0 +1,51 @@
// Test helper utilities
class TestHelpers {
static createMockValidator(options = {}) {
return {
validate: jest.fn().mockReturnValue(options.isValid || false),
errors: options.errors || [],
rules: options.rules || {}
};
}
static createValidationContext(data, rules) {
return {
data,
rules,
errors: [],
warnings: []
};
}
static generateTestCases(validData, invalidData, testName) {
const cases = [];
validData.forEach((data, index) => {
cases.push({
name: `${testName} - valid case ${index + 1}`,
input: data,
expected: true
});
});
invalidData.forEach((data, index) => {
cases.push({
name: `${testName} - invalid case ${index + 1}`,
input: data,
expected: false
});
});
return cases;
}
static mockAsyncValidator(delay = 100, result = true) {
return jest.fn().mockImplementation(() =>
new Promise(resolve =>
setTimeout(() => resolve(result), delay)
)
);
}
}
module.exports = TestHelpers;