@@ -39,55 +39,55 @@ afterEach(() => {
3939} ) ;
4040
4141describe ( "Overwrite Parameters" , async ( ) => {
42- const overwriteParamEmpty = [
43- // param, input, expectedResult
44- [
45- "overwrite_plate" ,
46- 1 ,
47- {
48- plate : "9HKA742" ,
49- score : 0.9 ,
50- candidates : [ { plate : "9HKA742" , score : 0.9 } ] ,
51- } ,
52- ] ,
53- [ "overwrite_direction" , 1 , { direction : 90 , plate : "9HKA742" , score : 0.9 } ] ,
54- [
55- "overwrite_orientation" ,
56- 1 ,
57- {
58- orientation : [ { orientation : "Rear" , score : 0.9 } ] ,
59- plate : "9HKA742" ,
60- score : 0.9 ,
61- } ,
62- ] ,
63- ] ;
64- test . each ( overwriteParamEmpty ) (
65- "Empty results Param: %s " ,
66- async ( param , input , modifiedResult ) => {
67- fetchMock
68- . get ( import . meta. env . SNAPSHOT_BASE_URL )
69- . intercept ( { path : "/v1/plate-reader/" , method : "POST" } )
70- . reply ( 200 , GenetecSnapshotResponse ) ;
71-
72- fetchMock
73- . get ( import . meta. env . PARKPOW_BASE_URL )
74- . intercept ( { path : "/api/v1/log-vehicle/" , method : "POST" } )
75- . reply ( 200 , ( { body } ) => {
76- // throw new Error(body)
77- return body ;
78- } ) ;
79- const url = `${ WORKER_REQUEST_INPUT } ?${ param } =${ input } ` ;
80- let req = createJsonUploadRequest ( url , GenetecSamplePayload , { } ) ;
81- let ctx = createExecutionContext ( ) ;
82- let response = await worker . fetch ( req , env , ctx ) ;
83- await waitOnExecutionContext ( ctx ) ;
84- expect ( await response . status ) . toBe ( 200 ) ;
85- const responseJson = await response . json ( ) ;
86- expect ( responseJson [ 0 ] [ "time" ] ) . toBe ( "2024-10-24T17:29:26Z" ) ;
87- expect ( responseJson [ 0 ] [ "camera" ] ) . toBe ( "G637821011231200521C - Camera" ) ;
88- expect ( responseJson [ 0 ] [ "results" ] ) . toStrictEqual ( [ modifiedResult ] ) ;
89- } ,
90- ) ;
42+ // const overwriteParamEmpty = [
43+ // // param, input, expectedResult
44+ // [
45+ // "overwrite_plate",
46+ // 1,
47+ // {
48+ // plate: "9HKA742",
49+ // score: 0.9,
50+ // candidates: [{ plate: "9HKA742", score: 0.9 }],
51+ // },
52+ // ],
53+ // ["overwrite_direction", 1, { direction: 90, plate: "9HKA742", score: 0.9 }],
54+ // [
55+ // "overwrite_orientation",
56+ // 1,
57+ // {
58+ // orientation: [{ orientation: "Rear", score: 0.9 }],
59+ // plate: "9HKA742",
60+ // score: 0.9,
61+ // },
62+ // ],
63+ // ];
64+ // test.each(overwriteParamEmpty)(
65+ // "Empty results Param: %s ",
66+ // async (param, input, modifiedResult) => {
67+ // fetchMock
68+ // .get(import.meta.env.SNAPSHOT_BASE_URL)
69+ // .intercept({ path: "/v1/plate-reader/", method: "POST" })
70+ // .reply(200, GenetecSnapshotResponse);
71+ //
72+ // fetchMock
73+ // .get(import.meta.env.PARKPOW_BASE_URL)
74+ // .intercept({ path: "/api/v1/log-vehicle/", method: "POST" })
75+ // .reply(200, ({ body }) => {
76+ // // throw new Error(body)
77+ // return body;
78+ // });
79+ // const url = `${WORKER_REQUEST_INPUT}?${param}=${input}`;
80+ // let req = createJsonUploadRequest(url, GenetecSamplePayload, {});
81+ // let ctx = createExecutionContext();
82+ // let response = await worker.fetch(req, env, ctx);
83+ // await waitOnExecutionContext(ctx);
84+ // expect(await response.status).toBe(200);
85+ // const responseJson = await response.json();
86+ // expect(responseJson[0]["time"]).toBe("2024-10-24T17:29:26Z");
87+ // expect(responseJson[0]["camera"]).toBe("G637821011231200521C - Camera");
88+ // expect(responseJson[0]["results"]).toStrictEqual([modifiedResult]);
89+ // },
90+ // );
9191
9292 const overwrittenPlateResult = {
9393 box : { xmin : 693 , ymin : 681 , xmax : 988 , ymax : 759 } ,
0 commit comments