Skip to content

Commit

Permalink
Enhance the parser test
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinSwierczynski committed Feb 26, 2024
1 parent fd09eb4 commit 9d2ac68
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions airly/response_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ func TestParseJsonResponse(t *testing.T) {

json := parseJsonResponse(file)

if len(json.Current.Indexes[0].Description) <= 0 {
t.Fatal("Description cannot be empty")
if json.Current.Indexes[0].Description != "Great air here today!" {
t.Fatal("Description needs to be proper")
}

if json.Current.Indexes[0].Value <= 0 {
t.Fatal("CAQI cannot be negative")
if json.Current.Indexes[0].Value != 7.43 {
t.Fatal("CAQI needs to be proper")
}

if json.Current.Standards[0].Percent != 29.71 {
t.Fatal("PM2.5 needs to be proper")
}
}

0 comments on commit 9d2ac68

Please sign in to comment.