improve testing for DataSeries#to_h and DataSeries#to_json

Signed-off-by: Miah Johnson <miah@chia-pet.org>
This commit is contained in:
Miah Johnson 2019-04-11 12:22:29 -07:00
parent 55ea2d984c
commit 5adf33469a

View file

@ -34,12 +34,15 @@ class TestTelemetryDataSeries < Minitest::Test
ds = Inspec::Telemetry::DataSeries.new('fizz')
ds << 'foo'
assert_kind_of Hash, ds.to_h
assert_equal 'fizz', ds.to_h[:name]
assert_equal ['foo'], ds.to_h[:data]
end
def test_to_json
ds = Inspec::Telemetry::DataSeries.new('fizz')
ds << 'foo'
assert_kind_of String, ds.to_json
assert_equal '{"name":"fizz","data":["foo"]}', ds.to_json
assert JSON.parse(ds.to_json)
end
end