Skip to content

Commit

Permalink
add test for load json
Browse files Browse the repository at this point in the history
  • Loading branch information
tannalynn committed Sep 21, 2023
1 parent 705bcd9 commit ba9ad3f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/new_relic/agent/monitors/synthetics_monitor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,32 @@ def test_records_synthetics_info_header_if_available
end
end

def test_load_json
info_payload = <<~PAYLOAD
{
"version": "1",
"type": "automatedTest",
"initiator": "cli",
"attributes": {
"attribute1": "on0e"
}
}
PAYLOAD

expected_info = {
'version' => '1',
'type' => 'automatedTest',
'initiator' => 'cli',
'attributes' => {
'attribute1' => 'one'
}
}

loaded = NewRelic::Agent::SyntheticsMonitor.new(@events).load_json(info_payload, 'info-header')

assert_equal expected_info, loaded
end

def both_synthetics_headers(payload, info_payload)
header_info_key = SyntheticsMonitor::SYNTHETICS_INFO_HEADER_KEY
synthetics_header(payload).merge({
Expand Down

0 comments on commit ba9ad3f

Please sign in to comment.