1
1
package main
2
2
3
3
import (
4
- "os"
5
4
"fmt"
5
+ "os"
6
6
"testing"
7
+
7
8
"github.com/spf13/afero"
8
9
)
9
10
@@ -25,22 +26,18 @@ func TestGetFileURL(t *testing.T) {
25
26
}
26
27
}
27
28
28
-
29
29
func TestShouldVersionFile (t * testing.T ) {
30
30
tests := []struct {
31
- filename string
32
- skipVersioning bool
33
- expected bool
34
- } {
35
- { "bundle.js" , false , true },
36
- { "bundle.js" , true , false },
37
- { "assets.css" , false , true },
38
- { "assets.css" , true , false },
39
- { "another.file" , false , false },
31
+ filename string
32
+ expected bool
33
+ }{
34
+ {"bundle.js" , true },
35
+ {"assets.css" , true },
36
+ {"another.file" , false },
40
37
}
41
38
42
39
for _ , test := range tests {
43
- actual := ShouldVersionFile (test .filename , test . skipVersioning )
40
+ actual := ShouldVersionFile (test .filename )
44
41
if actual != test .expected {
45
42
t .Errorf ("ShouldVersionFile result was incorrect, got %t, expected %t for filename %s" , actual , test .expected , test .filename )
46
43
}
@@ -53,13 +50,13 @@ func TestGetUploadFilename(t *testing.T) {
53
50
file , _ := AppFs .OpenFile (filename , os .O_CREATE , 0600 )
54
51
file .WriteString ("some JS content" )
55
52
tests := []struct {
56
- file afero.File
57
- filename string
53
+ file afero.File
54
+ filename string
58
55
skipVersioning bool
59
- expected string
60
- } {
61
- { file , filename , false , "bundle.d41d8cd98f00b204e9800998ecf8427e.js" },
62
- { file , filename , true , "bundle.js" },
56
+ expected string
57
+ }{
58
+ {file , filename , false , "bundle.d41d8cd98f00b204e9800998ecf8427e.js" },
59
+ {file , filename , true , "bundle.js" },
63
60
}
64
61
65
62
for _ , test := range tests {
@@ -69,4 +66,4 @@ func TestGetUploadFilename(t *testing.T) {
69
66
t .Errorf ("GetUploadFilename result was incorrect, got %s, expected %s" , actual , test .expected )
70
67
}
71
68
}
72
- }
69
+ }
0 commit comments