@@ -5,8 +5,8 @@ const fixture = require('./fixtures/pet-store.json');
55describe ( 'Pet Store' , ( ) => {
66 let chowchow : ChowChow ;
77
8- beforeAll ( ( ) => {
9- chowchow = new ChowChow ( fixture as any ) ;
8+ beforeAll ( async ( ) => {
9+ chowchow = await ChowChow . create ( fixture as any ) ;
1010 } ) ;
1111
1212 test ( 'It should throw an error if a path is undefined' , ( ) => {
@@ -105,11 +105,11 @@ describe('Pet Store', () => {
105105 } ) ;
106106 } ) ;
107107 describe ( 'Configure ChowOptions for allErrors' , ( ) => {
108- test ( 'It should fail validation and receive multiple errors if payload is invalid and ChowOptions configured with allErrors:true' , ( ) => {
108+ test ( 'It should fail validation and receive multiple errors if payload is invalid and ChowOptions configured with allErrors:true' , async ( ) => {
109109 let chowOptions : Partial < ChowOptions > = {
110110 requestBodyAjvOptions : { allErrors : true } ,
111111 } ;
112- chowchow = new ChowChow ( fixture as any , chowOptions ) ;
112+ chowchow = await ChowChow . create ( fixture as any , chowOptions ) ;
113113
114114 try {
115115 chowchow . validateRequestByPath ( '/pets' , 'post' , {
@@ -131,11 +131,11 @@ describe('Pet Store', () => {
131131 }
132132 } ) ;
133133
134- test ( 'It should fail validation and receive a single error if payload is invalid and ChowOptions configured for allErrors:false' , ( ) => {
134+ test ( 'It should fail validation and receive a single error if payload is invalid and ChowOptions configured for allErrors:false' , async ( ) => {
135135 let chowOptions : Partial < ChowOptions > = {
136136 requestBodyAjvOptions : { allErrors : false } ,
137137 } ;
138- chowchow = new ChowChow ( fixture as any , chowOptions ) ;
138+ chowchow = await ChowChow . create ( fixture as any , chowOptions ) ;
139139
140140 try {
141141 chowchow . validateRequestByPath ( '/pets' , 'post' , {
@@ -157,8 +157,8 @@ describe('Pet Store', () => {
157157 }
158158 } ) ;
159159
160- test ( 'It should fail validation and receive a single error if payload is invalid and ChowOptions not configured' , ( ) => {
161- chowchow = new ChowChow ( fixture as any ) ;
160+ test ( 'It should fail validation and receive a single error if payload is invalid and ChowOptions not configured' , async ( ) => {
161+ chowchow = await ChowChow . create ( fixture as any ) ;
162162
163163 try {
164164 chowchow . validateRequestByPath ( '/pets' , 'post' , {
0 commit comments