MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / validateTestStep

Function validateTestStep

test/contract/p4-schema.test.ts:148–166  ·  view source on GitHub ↗
(value: unknown, label = 'TestStep')

Source from the content-addressed store, hash-verified

146}
147
148function validateTestStep(value: unknown, label = 'TestStep'): void {
149 expect(value, `${label}: must be an object`).toBeTypeOf('object');
150 expect(value, `${label}: must not be null`).not.toBeNull();
151 const obj = value as Record<string, unknown>;
152 expectRequired(obj, TEST_STEP_REQUIRED, label);
153 expectKeysMatch(obj, TEST_STEP_ALL, label);
154 expect(typeof obj.testId, `${label}.testId`).toBe('string');
155 expect(typeof obj.stepIndex, `${label}.stepIndex`).toBe('number');
156 expect((obj.stepIndex as number) >= 1, `${label}.stepIndex >= 1`).toBe(true);
157 expect(typeof obj.action, `${label}.action`).toBe('string');
158 expect(typeof obj.description, `${label}.description`).toBe('string');
159 expect(STEP_STATUS_VALUES.has(obj.status), `${label}.status`).toBe(true);
160 expectStringOrNull(obj.screenshotUrl, `${label}.screenshotUrl`);
161 expectStringOrNull(obj.htmlSnapshotUrl, `${label}.htmlSnapshotUrl`);
162 expectStringOrNull(obj.runIdIfAvailable, `${label}.runIdIfAvailable`);
163 expectStringOrNull(obj.codeVersion, `${label}.codeVersion`);
164 expectStringOrNull(obj.capturedAt, `${label}.capturedAt`);
165 expect(typeof obj.updatedAt, `${label}.updatedAt`).toBe('string');
166}
167
168function validateTestStepList(value: unknown, label = 'TestStepList'): void {
169 expect(value, `${label}: must be an object`).toBeTypeOf('object');

Callers 2

validateTestStepListFunction · 0.85
p4-schema.test.tsFile · 0.85

Calls 3

expectRequiredFunction · 0.70
expectKeysMatchFunction · 0.70
expectStringOrNullFunction · 0.70

Tested by

no test coverage detected