(value: unknown, label = 'TestCode')
| 132 | } |
| 133 | |
| 134 | function 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 | |
| 148 | function validateTestStep(value: unknown, label = 'TestStep'): void { |
| 149 | expect(value, `${label}: must be an object`).toBeTypeOf('object'); |
no test coverage detected