MCPcopy Create free account
hub / github.com/alibaba/open-code-review / assertValidation

Function assertValidation

scripts/github-actions/action-contract.test.js:348–362  ·  view source on GitHub ↗
(value, expectedValid)

Source from the content-addressed store, hash-verified

346}
347
348function assertValidation(value, expectedValid) {
349 const step = validationStep();
350 assert.ok(step, "action.yml must add a validation step that references review_task_timeout");
351 const fixture = makeFixture();
352 try {
353 const result = runStep(step, inputValues({ review_task_timeout: value }), fixture);
354 if (expectedValid) {
355 assert.strictEqual(result.status, 0, `review_task_timeout=${JSON.stringify(value)} should be accepted; ${resultDescription(result)}`);
356 } else {
357 assert.notStrictEqual(result.status, 0, `review_task_timeout=${JSON.stringify(value)} should be rejected; ${resultDescription(result)}`);
358 }
359 } finally {
360 removeFixture(fixture);
361 }
362}
363
364function testReviewTaskTimeoutInputNameAndScope() {
365 assert.ok(INPUTS.review_task_timeout, "action.yml must define the review_task_timeout input");

Calls 6

validationStepFunction · 0.85
makeFixtureFunction · 0.85
runStepFunction · 0.85
inputValuesFunction · 0.85
resultDescriptionFunction · 0.85
removeFixtureFunction · 0.85

Tested by

no test coverage detected