diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42c2aa5..a6f7a1a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: uses: actions/checkout@v2 - name: Vet code - run: go vet + run: go vet ./... format: name: Format @@ -59,7 +59,7 @@ jobs: git config --local user.name "GitHub Action" - name: Format code - run: gofmt -l -w -s . + run: gofmt -l -w -s ./... - name: Commit and push changes id: commit-dockerfiles diff --git a/Makefile b/Makefile index 528b5ab..cc555dc 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ datetime: *.go data/*.go .PHONY: test test: data - $(GO) test -cover -bench=. -v + $(GO) test -cover -bench=. -v ./... DATASETS = \ diff --git a/assets/css/styles.css b/assets/css/styles.css index 387c5a0..88ac68d 100644 --- a/assets/css/styles.css +++ b/assets/css/styles.css @@ -205,6 +205,7 @@ d-zoneinfo { d-zonename { display: inline; + font-size: 0.75em; font-weight: 600; } diff --git a/data/data.go b/data/data.go index 6f9d555..ee1fd1e 100644 --- a/data/data.go +++ b/data/data.go @@ -29,7 +29,7 @@ func extendName(names ...string) string { // FullName returns a fully qualified human readable name func (c City) FullName() string { if len(c.Admin1.Name) > 0 { - return extendName(c.Name, c.Admin1.Name, c.Country.Name) + return extendName(c.Name, c.Admin1.Name, c.Country.Ref) } - return extendName(c.Name, c.Country.Name) + return extendName(c.Name, c.Country.Ref) } diff --git a/data/data_test.go b/data/data_test.go new file mode 100644 index 0000000..a604f8e --- /dev/null +++ b/data/data_test.go @@ -0,0 +1,37 @@ +package data + +import ( + "testing" +) + +func TestCityFullName(t *testing.T) { + c := City{ + Name: "'cit-y N'ame-", + Admin1: Admin1{ + Name: "a-dmin1, Name'", + }, + Country: Country{ + Name: "Country Name", + Ref: "CN", + }, + } + + got, want := c.FullName(), "'cit-y N'ame-, a-dmin1, Name', CN" + if got != want { + t.Errorf("got %v, want %v", got, want) + } + + c = City{ + Name: "City Name", + Admin1: Admin1{}, + Country: Country{ + Name: "Name Country", + Ref: "CN", + }, + } + + got, want = c.FullName(), "City Name, CN" + if got != want { + t.Errorf("got %v, want %v", got, want) + } +}