@@ -18,21 +18,43 @@ async function loadV2Job(resourcePath: string): Promise<JobResponse> {
1818}
1919
2020describe ( "MindeeV2 - Job Response" , async ( ) => {
21+
2122 describe ( "Success" , async ( ) => {
2223 it ( "should load when status is Processing" , async ( ) => {
2324 const response = await loadV2Job (
2425 path . join ( jobPath , "ok_processing.json" )
2526 ) ;
2627 assert . ok ( response . job ) ;
28+ assert . strictEqual ( response . job . status , "Processing" ) ;
29+ assert . ok ( response . job . createdAt instanceof Date ) ;
30+ assert . strictEqual ( response . job . completedAt , undefined ) ;
31+ assert . strictEqual ( response . job . error , undefined ) ;
32+ } ) ;
33+
34+ it ( "should load when status is Processed" , async ( ) => {
35+ const response = await loadV2Job (
36+ path . join ( jobPath , "ok_processed_webhooks_ok.json" )
37+ ) ;
38+ assert . ok ( response . job ) ;
39+ assert . strictEqual ( response . job . status , "Processed" ) ;
40+ assert . ok ( response . job . createdAt instanceof Date ) ;
41+ assert . ok ( response . job . completedAt instanceof Date ) ;
2742 assert . strictEqual ( response . job . error , undefined ) ;
43+ response . job . webhooks . forEach ( ( webhook ) => {
44+ assert . ok ( webhook . id ) ;
45+ assert . ok ( webhook . createdAt instanceof Date ) ;
46+ } ) ;
2847 } ) ;
2948 } ) ;
49+
3050 describe ( "Failure" , async ( ) => {
3151 it ( "should load with 422 error" , async ( ) => {
3252 const response = await loadV2Job (
3353 path . join ( jobPath , "fail_422.json" )
3454 ) ;
3555 assert . ok ( response . job ) ;
56+ assert . ok ( response . job . createdAt instanceof Date ) ;
57+ assert . ok ( response . job . completedAt instanceof Date ) ;
3658 assert . ok ( response . job . error instanceof ErrorResponse ) ;
3759 assert . strictEqual ( response . job . error ?. status , 422 ) ;
3860 assert . ok ( response . job . error ?. code . startsWith ( "422-" ) ) ;
0 commit comments