mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
* Add draft of covid module * Work on pointers * Add country stats * Remove recovered, stays at 0 * Handle response code * One struct for both * List of countries * Add test * Add test for countries * Fix typos * Format numbers based on language/locale
32 lines
717 B
Go
32 lines
717 B
Go
package covid
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestLatestCases(t *testing.T) {
|
|
latestCasesToAssert, err := LatestCases()
|
|
if err != nil {
|
|
t.Error("LatestCases() returned an error")
|
|
}
|
|
if latestCasesToAssert.Latest.Confirmed == 0 {
|
|
t.Error("LatestCases() should return a non 0 integer")
|
|
}
|
|
}
|
|
|
|
func (widget *Widget) TestCountryCases(t *testing.T) {
|
|
countryList := []string{"US", "FR"}
|
|
c := make([]interface{}, len(countryList))
|
|
for i, v := range countryList {
|
|
c[i] = v
|
|
}
|
|
latestCountryCasesToAssert, err := widget.LatestCountryCases(c)
|
|
if err != nil {
|
|
t.Error("LatestCountryCases() returned an error")
|
|
}
|
|
if len(latestCountryCasesToAssert) == 0 {
|
|
t.Error("LatestCountryCases() should not be empty")
|
|
}
|
|
|
|
}
|