fix(owm): adjust icons outside of the MD range

This commit is contained in:
Matthew Miller 2023-05-09 03:06:39 -04:00 committed by GitHub
parent ca0a9c0e14
commit dc085abb06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 22 deletions

View file

@ -112,13 +112,13 @@ func (d *Owm) setStatus() error {
icon := ""
switch id {
case "01n":
fallthrough
icon = "\ue32b"
case "01d":
icon = "\U000f0599"
icon = "\ue30d"
case "02n":
fallthrough
icon = "\ue37e"
case "02d":
icon = "\ufa94"
icon = "\ue302"
case "03n":
fallthrough
case "03d":
@ -130,15 +130,15 @@ func (d *Owm) setStatus() error {
case "09n":
fallthrough
case "09d":
icon = "\U000f0596"
icon = "\ue319"
case "10n":
fallthrough
icon = "\ue325"
case "10d":
icon = "\ue308"
case "11n":
fallthrough
icon = "\ue32a"
case "11d":
icon = "\ue31d"
icon = "\ue30f"
case "13n":
fallthrough
case "13d":

View file

@ -27,20 +27,20 @@ func TestOWMSegmentSingle(t *testing.T) {
{
Case: "Sunny Display",
JSONResponse: `{"weather":[{"icon":"01d"}],"main":{"temp":20}}`,
ExpectedString: "\U000f0599 (20°C)",
ExpectedString: "\ue30d (20°C)",
ExpectedEnabled: true,
},
{
Case: "Sunny Display",
JSONResponse: `{"weather":[{"icon":"01d"}],"main":{"temp":20}}`,
ExpectedString: "\U000f0599 (20°C)",
ExpectedString: "\ue30d (20°C)",
ExpectedEnabled: true,
Template: "{{.Weather}} ({{.Temperature}}{{.UnitIcon}})",
},
{
Case: "Sunny Display",
JSONResponse: `{"weather":[{"icon":"01d"}],"main":{"temp":20}}`,
ExpectedString: "\U000f0599",
ExpectedString: "\ue30d",
ExpectedEnabled: true,
Template: "{{.Weather}} ",
},
@ -90,12 +90,12 @@ func TestOWMSegmentIcons(t *testing.T) {
{
Case: "Sunny Display day",
IconID: "01d",
ExpectedIconString: "\U000f0599",
ExpectedIconString: "\ue30d",
},
{
Case: "Light clouds Display day",
IconID: "02d",
ExpectedIconString: "\ufa94",
ExpectedIconString: "\ue302",
},
{
Case: "Cloudy Display day",
@ -110,7 +110,7 @@ func TestOWMSegmentIcons(t *testing.T) {
{
Case: "Shower Rain Display day",
IconID: "09d",
ExpectedIconString: "\U000f0596",
ExpectedIconString: "\ue319",
},
{
Case: "Rain Display day",
@ -120,7 +120,7 @@ func TestOWMSegmentIcons(t *testing.T) {
{
Case: "Thunderstorm Display day",
IconID: "11d",
ExpectedIconString: "\ue31d",
ExpectedIconString: "\ue30f",
},
{
Case: "Snow Display day",
@ -136,12 +136,12 @@ func TestOWMSegmentIcons(t *testing.T) {
{
Case: "Sunny Display night",
IconID: "01n",
ExpectedIconString: "\U000f0599",
ExpectedIconString: "\ue32b",
},
{
Case: "Light clouds Display night",
IconID: "02n",
ExpectedIconString: "\ufa94",
ExpectedIconString: "\ue37e",
},
{
Case: "Cloudy Display night",
@ -156,17 +156,17 @@ func TestOWMSegmentIcons(t *testing.T) {
{
Case: "Shower Rain Display night",
IconID: "09n",
ExpectedIconString: "\U000f0596",
ExpectedIconString: "\ue319",
},
{
Case: "Rain Display night",
IconID: "10n",
ExpectedIconString: "\ue308",
ExpectedIconString: "\ue325",
},
{
Case: "Thunderstorm Display night",
IconID: "11n",
ExpectedIconString: "\ue31d",
ExpectedIconString: "\ue32a",
},
{
Case: "Snow Display night",
@ -227,7 +227,7 @@ func TestOWMSegmentIcons(t *testing.T) {
}
func TestOWMSegmentFromCache(t *testing.T) {
response := fmt.Sprintf(`{"weather":[{"icon":"%s"}],"main":{"temp":20}}`, "01d")
expectedString := fmt.Sprintf("%s (20°C)", "\U000f0599")
expectedString := fmt.Sprintf("%s (20°C)", "\ue30d")
env := &mock.MockedEnvironment{}
cache := &mock.MockedCache{}
@ -250,7 +250,7 @@ func TestOWMSegmentFromCache(t *testing.T) {
func TestOWMSegmentFromCacheWithHyperlink(t *testing.T) {
response := fmt.Sprintf(`{"weather":[{"icon":"%s"}],"main":{"temp":20}}`, "01d")
expectedString := fmt.Sprintf("«%s (20°C)»(http://api.openweathermap.org/data/2.5/weather?q=AMSTERDAM,NL&units=metric&appid=key)", "\U000f0599")
expectedString := fmt.Sprintf("«%s (20°C)»(http://api.openweathermap.org/data/2.5/weather?q=AMSTERDAM,NL&units=metric&appid=key)", "\ue30d")
env := &mock.MockedEnvironment{}
cache := &mock.MockedCache{}