11import test from "ava" ;
22
33import * as json from "../json" ;
4+ import { makeFromSchema } from "../json/testing-util" ;
45import { setupTests } from "../testing-utils" ;
56
67import * as types from "./types" ;
78import { getAuthConfig } from "./validation" ;
89
910setupTests ( test ) ;
1011
11- function makeFromSchema (
12- includeOptional : boolean ,
13- schema : json . Schema ,
14- ) : json . FromSchema < typeof schema > {
15- const result = { } ;
16- for ( const [ key , validator ] of Object . entries ( schema ) ) {
17- if ( ! validator . required && ! includeOptional ) {
18- continue ;
19- }
20- result [ key ] = `value-for-${ key } ` ;
21- }
22- return result ;
23- }
24-
25- const schemaTests = [
26- { schema : types . azureConfigSchema , name : "isAzureConfig" } ,
27- { schema : types . awsConfigSchema , name : "isAWSConfig" } ,
28- { schema : types . jfrogConfigSchema , name : "isJFrogConfig" } ,
29- ] as Array < { schema : json . Schema ; name : string } > ;
30-
31- for ( const schemaTest of schemaTests ) {
12+ for ( const schemaTest of types . oidcSchemas ) {
3213 for ( const includeOptional of [ true , false ] ) {
3314 const minimalName = includeOptional ? "full" : "minimal" ;
3415
@@ -39,7 +20,7 @@ for (const schemaTest of schemaTests) {
3920 getAuthConfig ( {
4021 ...config ,
4122 unexpected : "unexpected-value" ,
42- } as json . UnvalidatedObject < types . AuthConfig > ) ,
23+ } as unknown as json . UnvalidatedObject < types . AuthConfig > ) ,
4324 config ,
4425 ) ;
4526 } ) ;
0 commit comments