-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels_test.go
91 lines (85 loc) · 1.87 KB
/
models_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package godatagovgr
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestStringer(t *testing.T) {
// Test for number data.
numberData := &NumberData{
Year: 2020,
Quarter: "Q1",
Active: 73768,
Entrants: 8768,
Exits: 897,
}
assert.Equal(t, `{
"year": 2020,
"quarter": "Q1",
"active": 73768,
"entrants": 8768,
"exits": 897
}`,
numberData.String(),
)
// Test for voters per age data.
votersPerAge := &VotersPerAgeData{
Year: 2020,
AgeGroup: "18-23",
ElectionType: "Βουλευτικές",
ElectoralDistrict: "Καρδίτσας",
Count: 35000,
}
assert.Equal(t, `{
"year": 2020,
"election_type": "Βουλευτικές",
"electoral_district": "Καρδίτσας",
"age_group": "18-23",
"count": 35000
}`,
votersPerAge.String(),
)
}
func TestStringerOmitEmpty(t *testing.T) {
objects := []Stringable{
&AcademicProfessorData{},
&AuditorData{},
&CadastrePlotData{},
&CasinoTicketData{},
&CrimeStatData{},
&ElectricityConsumptionData{},
&EnergyBalanceData{},
&EudoxusApplicationData{},
&FinancialCrimeData{},
&FoodInspectionData{},
&ForestFireData{},
&HellenicCoastGuardIncidentData{},
&InternshipData{},
&InternetTrafficData{},
&LandConfiscationData{},
&LandHorizontalAreaData{},
&LandHorizontalPlotData{},
&LandLienData{},
&LandOwnerData{},
&LandPlotData{},
&LandRegistryStatusData{},
&LandTransactionData{},
&NumberData{},
&PowerSystemLoadData{},
&ResProductionData{},
&RidershipData{},
&RoadTrafficData{},
&SailingTrafficData{},
&StudentSchoolData{},
&TelecomIndicatorData{},
&TrafficAccidentData{},
&TrafficViolationData{},
&UnemploymentData{},
&UrbanIncidentData{},
&VaccinationData{},
&VotersPerAgeData{},
&VotersPerMunicipalityData{},
}
for _, object := range objects {
assert.Equal(t, "{}", object.String())
}
}