mirror of
https://github.com/pcvolkmer/idicon.git
synced 2025-04-19 16:46:50 +00:00
Use long and short gh param value for color scheme and pattern
This commit is contained in:
parent
18a1c2276b
commit
6f3912a543
@ -47,12 +47,12 @@ func requestHandler(w http.ResponseWriter, r *http.Request) {
|
||||
cFunc := icons.ColorV2
|
||||
if colorScheme == "v1" {
|
||||
cFunc = icons.ColorV1
|
||||
} else if colorScheme == "gh" {
|
||||
} else if colorScheme == "gh" || colorScheme == "github" {
|
||||
cFunc = icons.ColorGh
|
||||
}
|
||||
|
||||
var iconGenerator icons.IconGenerator
|
||||
if pattern == "github" {
|
||||
if pattern == "github" || pattern == "gh" {
|
||||
iconGenerator = icons.NewGhIconGenerator().WithColorGenerator(cFunc)
|
||||
} else {
|
||||
iconGenerator = icons.NewIdIconGenerator().WithColorGenerator(cFunc)
|
||||
|
@ -85,6 +85,20 @@ func TestCorrectResponseForGHColorSchemeAndPattern(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCorrectResponseForAltGHColorSchemeAndPattern(t *testing.T) {
|
||||
req, err := http.NewRequest("GET", "/avatar/1a79a4d60de6718e8e5b326e338ae533?c=github&d=gh", nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
rr := httptest.NewRecorder()
|
||||
testRouter().ServeHTTP(rr, req)
|
||||
|
||||
if !reflect.DeepEqual(rr.Body.Bytes(), gh1) {
|
||||
t.Errorf("returned image does not match expected image")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUsesConfig(t *testing.T) {
|
||||
configure("./testdata/testconfig.toml")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user