@@ -2,7 +2,7 @@ import { Given, Then, When, AfterAll } from "@cucumber/cucumber";
2
2
import { expect } from "chai" ;
3
3
import { World } from "../support/world" ;
4
4
5
- import { getProperty , pathLookup } from "../support/templating" ;
5
+ import { getProperty , pathLookup , getTypeForValue } from "../support/templating" ;
6
6
import { Store } from "../support/store" ;
7
7
import { buildUndoFor , UndoActions } from "../support/undo" ;
8
8
import * as datadogApiClient from "../../index" ;
@@ -134,13 +134,6 @@ When("the request is sent", async function (this: World) {
134
134
this . response = await apiInstance [ this . operationId . toOperationName ( ) ] ( ) ;
135
135
}
136
136
137
- const objectSerializer = getProperty ( datadogApiClient , this . apiVersion ) . ObjectSerializer ;
138
- this . response = objectSerializer . serialize (
139
- this . response ,
140
- ScenariosModelMappings [ `${ this . apiVersion } .${ this . operationId } ` ] [ "operationResponseType" ] ,
141
- "" ,
142
- )
143
-
144
137
if ( undoAction . undo . type == "unsafe" ) {
145
138
this . undo . push (
146
139
buildUndoFor (
@@ -262,9 +255,16 @@ Then(
262
255
Then (
263
256
/ t h e r e s p o n s e " ( [ ^ " ] + ) " i s e q u a l t o ( .* ) / ,
264
257
function ( this : World , responsePath : string , value : string ) {
265
- expect ( pathLookup ( this . response , responsePath ) ) . to . deep . equal (
266
- JSON . parse ( value . templated ( this . fixtures ) )
267
- ) ;
258
+ const pathResult = pathLookup ( this . response , responsePath )
259
+ const _type = getTypeForValue ( pathResult )
260
+ let templatedFixtureValue = JSON . parse ( value . templated ( this . fixtures ) )
261
+
262
+ if ( _type ) {
263
+ const objectSerializer = getProperty ( datadogApiClient , this . apiVersion ) . ObjectSerializer ;
264
+ templatedFixtureValue = objectSerializer . deserialize ( templatedFixtureValue , _type , "" )
265
+ }
266
+
267
+ expect ( pathResult ) . to . deep . equal ( templatedFixtureValue ) ;
268
268
}
269
269
) ;
270
270
0 commit comments