-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Szymon Mikitiuk
committed
Nov 11, 2023
1 parent
3758c85
commit 6a1d640
Showing
3 changed files
with
101 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package urlshort | ||
|
||
import ( | ||
"net/http" | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func TestMapHandler(t *testing.T) { | ||
type args struct { | ||
pathsToUrls map[string]string | ||
fallback http.Handler | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want http.HandlerFunc | ||
}{ | ||
// TODO: Add test cases. | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := MapHandler(tt.args.pathsToUrls, tt.args.fallback); !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("MapHandler() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func TestYAMLHandler(t *testing.T) { | ||
type args struct { | ||
yml []byte | ||
fallback http.Handler | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want http.HandlerFunc | ||
wantErr bool | ||
}{ | ||
// TODO: Add test cases. | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, err := YAMLHandler(tt.args.yml, tt.args.fallback) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("YAMLHandler() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
if !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("YAMLHandler() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func TestJSONHandler(t *testing.T) { | ||
type args struct { | ||
jsonInput []byte | ||
fallback http.Handler | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want http.HandlerFunc | ||
wantErr bool | ||
}{ | ||
// TODO: Add test cases. | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, err := JSONHandler(tt.args.jsonInput, tt.args.fallback) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("JSONHandler() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
if !reflect.DeepEqual(got, tt.want) { | ||
t.Errorf("JSONHandler() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |