forked from mmadfox/go-crx3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunpack_test.go
54 lines (51 loc) · 1.16 KB
/
unpack_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package crx
import (
"testing"
)
// func TestUnpack(t *testing.T) {
// stats := map[string]int{
// "background.js": 0,
// "images": 0,
// "images/image.jpeg": 0,
// "manifest.json": 0,
// }
// err := Unpack("./testdata/unpack/extension.crx")
// assert.Nil(t, err)
// err = filepath.Walk("./testdata/unpack/extension", func(path string, info os.FileInfo, err error) error {
// relpath, err := filepath.Rel("./testdata/unpack/extension", path)
// assert.Nil(t, err)
// stats[relpath]++
// return nil
// })
// assert.Nil(t, err)
// for _, v := range stats {
// assert.Equal(t, 1, v)
// }
// err = os.RemoveAll("./testdata/unpack/extension")
// assert.Nil(t, err)
// }
func TestUnpack(t *testing.T) {
type args struct {
filename string
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: "crx2",
args: args{
filename: "./testdata/crx2/thy_4.1.crx",
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := Unpack(tt.args.filename); (err != nil) != tt.wantErr {
t.Errorf("Unpack() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}