-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharchive_test.go
53 lines (37 loc) · 1015 Bytes
/
archive_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
package k6deps
import (
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
)
func Test_analyzeArchive(t *testing.T) {
t.Parallel()
opts := &Options{
Archive: Source{Name: filepath.Join("testdata", "archive.tar")},
}
actual, err := Analyze(opts)
require.NoError(t, err)
opts = &Options{
Script: Source{Name: filepath.Join("testdata", "combined.js")},
Manifest: Source{Ignore: true},
Env: Source{Ignore: true},
}
expected, err := Analyze(opts)
require.NoError(t, err)
require.Equal(t, expected.String(), actual.String())
}
func Test_analyzeArchive_Reader(t *testing.T) {
t.Parallel()
file, err := os.Open(filepath.Join("testdata", "archive.tar")) //nolint:forbidigo
require.NoError(t, err)
defer file.Close() //nolint:errcheck
opts := &Options{
Archive: Source{Reader: file},
}
actual, err := Analyze(opts)
require.NoError(t, err)
expected, err := Analyze(opts)
require.NoError(t, err)
require.Equal(t, expected.String(), actual.String())
}