Skip to content

Commit

Permalink
Change synthetics unparsed test (#1783)
Browse files Browse the repository at this point in the history
In preparation for a method enum change, let's change the test.
  • Loading branch information
therve committed Dec 7, 2022
1 parent cd4a089 commit debc4b7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/api/deserialization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ func TestDeserializationUnkownNestedEnum(t *testing.T) {
"config": {
"request": {
"url": "https://www.10.0.0.1.xip.io",
"method": "A non existent method",
"method": "GET",
"timeout": 30
},
"assertions": [
{
"operator": "is",
"operator": "not-an-operator",
"type": "statusCode",
"target": 200
}
Expand All @@ -316,13 +316,10 @@ func TestDeserializationUnkownNestedEnum(t *testing.T) {
resp, httpresp, err := api.GetAPITest(ctx, "public_id")
assert.Nil(err)
assert.Equal(299, httpresp.StatusCode)
// UnparsedObject is propagated up
assert.NotNil(resp.UnparsedObject)
assert.NotNil(resp.Config.UnparsedObject)
// Direct parent of invalid enum is unparsed
assert.NotNil(resp.Config.Request.UnparsedObject)
assert.Equal("A non existent method", resp.Config.Request.UnparsedObject["method"])
assert.Equal(float64(30), resp.Config.Request.UnparsedObject["timeout"])
assert.NotNil(resp.Config.Assertions[0].UnparsedObject)
assert.Equal("not-an-operator", resp.Config.Assertions[0].UnparsedObject.(map[string]interface{})["operator"])
assert.Equal(float64(200), resp.Config.Assertions[0].UnparsedObject.(map[string]interface{})["target"])
assert.True(datadog.ContainsUnparsedObject(resp))
}

Expand Down

0 comments on commit debc4b7

Please sign in to comment.