add test to parse_topic_1
All checks were successful
Unit Tests / Run Tests (push) Successful in 11s
All checks were successful
Unit Tests / Run Tests (push) Successful in 11s
This commit is contained in:
parent
a1020b80d2
commit
536344d6c4
1 changed files with 12 additions and 0 deletions
|
|
@ -16,3 +16,15 @@ pub fn file_read_test() {
|
|||
reading
|
||||
|> should.equal("Temperature 20.5 °C")
|
||||
}
|
||||
|
||||
pub fn parse_topic_1_test() {
|
||||
let json_string =
|
||||
"{\"temp\":18.84,\"humidity\":28.690811,\"pressure\":944.67}"
|
||||
let readings = sensors.parse_topic_1(json_string)
|
||||
readings
|
||||
|> should.equal([
|
||||
sensors.SensorReading(sensor: sensors.Temperature, value: 18.84),
|
||||
sensors.SensorReading(sensor: sensors.Humidity, value: 28.690811),
|
||||
sensors.SensorReading(sensor: sensors.Pressure, value: 944.67),
|
||||
])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue