|
1 | 1 | import ts from "typescript" |
2 | | -import type {Input} from "../../../core/input" |
| 2 | +import type {Input, SchemaNormalizer} from "../../../core/input" |
3 | 3 | import type { |
4 | 4 | Reference, |
5 | 5 | Schema, |
@@ -27,20 +27,27 @@ export function schemaBuilderTestHarness( |
27 | 27 | schema: Schema, |
28 | 28 | config: SchemaBuilderConfig = {allowAny: false}, |
29 | 29 | ) { |
30 | | - const {input} = await unitTestInput(version) |
31 | | - return getResult(input, schema, true, config) |
| 30 | + const {input, schemaNormalizer} = await unitTestInput(version) |
| 31 | + return getResult(input, schemaNormalizer, schema, true, config) |
32 | 32 | } |
33 | 33 |
|
34 | 34 | async function getActual( |
35 | 35 | path: string, |
36 | 36 | config: SchemaBuilderConfig = {allowAny: false}, |
37 | 37 | ) { |
38 | | - const {input, file} = await unitTestInput(version) |
39 | | - return getResult(input, {$ref: `${file}#${path}`}, true, config) |
| 38 | + const {input, schemaNormalizer, file} = await unitTestInput(version) |
| 39 | + return getResult( |
| 40 | + input, |
| 41 | + schemaNormalizer, |
| 42 | + {$ref: `${file}#${path}`}, |
| 43 | + true, |
| 44 | + config, |
| 45 | + ) |
40 | 46 | } |
41 | 47 |
|
42 | 48 | async function getResult( |
43 | 49 | input: Input, |
| 50 | + schemaNormalizer: SchemaNormalizer, |
44 | 51 | maybeSchema: Schema | Reference, |
45 | 52 | required: boolean, |
46 | 53 | config: SchemaBuilderConfig, |
@@ -70,7 +77,7 @@ export function schemaBuilderTestHarness( |
70 | 77 | .fromModel( |
71 | 78 | isRef(maybeSchema) |
72 | 79 | ? maybeSchema |
73 | | - : input.schemaNormalizer.normalize(maybeSchema), |
| 80 | + : schemaNormalizer.normalize(maybeSchema), |
74 | 81 | required, |
75 | 82 | ) |
76 | 83 |
|
|
0 commit comments