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

Function validateTestCode

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

Source from the content-addressed store, hash-verified

132}
133
134function validateTestCode(value: unknown, label = 'TestCode'): void {
135 expect(value, `${label}: must be an object`).toBeTypeOf('object');
136 expect(value, `${label}: must not be null`).not.toBeNull();
137 const obj = value as Record<string, unknown>;
138 expectRequired(obj, TEST_CODE_REQUIRED, label);
139 expectKeysMatch(obj, TEST_CODE_ALL, label);
140 expect(typeof obj.testId, `${label}.testId`).toBe('string');
141 expect(CODE_LANGUAGES, `${label}.language`).toContain(obj.language);
142 expect(CODE_FRAMEWORKS, `${label}.framework`).toContain(obj.framework);
143 expect(typeof obj.code, `${label}.code`).toBe('string');
144 expectStringOrNull(obj.codeVersion, `${label}.codeVersion`);
145 if ('etag' in obj) expectStringOrNull(obj.etag, `${label}.etag`);
146}
147
148function validateTestStep(value: unknown, label = 'TestStep'): void {
149 expect(value, `${label}: must be an object`).toBeTypeOf('object');

Callers 1

p4-schema.test.tsFile · 0.85

Calls 3

expectRequiredFunction · 0.70
expectKeysMatchFunction · 0.70
expectStringOrNullFunction · 0.70

Tested by

no test coverage detected