Skip to content
Snippets Groups Projects
Commit e80aa0ee authored by Danis Kirasirov's avatar Danis Kirasirov
Browse files

refactor

parent 7f14f157
No related branches found
No related tags found
No related merge requests found
......@@ -16,13 +16,13 @@ func TestFile_SetURLWithTemplate(t *testing.T) {
wantURL string
}{
{
name: "template is nil",
file: &File{
URL: "https://cloud.com/",
name: "template is nil",
file: &File{
URL: "https://cloud.com/",
},
template: nil,
wantErr: false,
wantURL: "https://cloud.com/",
wantURL: "https://cloud.com/",
},
{
name: "template is bad",
......@@ -31,15 +31,15 @@ func TestFile_SetURLWithTemplate(t *testing.T) {
wantErr: true,
},
{
name: "success",
file: &File{
name: "success",
file: &File{
Size: 1024,
MimeType: "image/png",
Key: "file-key",
},
template: template.Must(template.New("url").Parse("https://cloud-proxy.com/{{.Key}}?size={{.Size}}#{{.MimeType}}")),
wantErr: false,
wantURL: "https://cloud-proxy.com/file-key?size=1024#image/png",
wantURL: "https://cloud-proxy.com/file-key?size=1024#image/png",
},
}
......@@ -47,7 +47,7 @@ func TestFile_SetURLWithTemplate(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
err := tt.file.SetURLWithTemplate(tt.template)
if tt.wantErr {
require.Error(t, err)
require.Error(t, err)
} else {
require.NoError(t, err)
require.Equal(t, tt.wantURL, tt.file.URL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment