-
Notifications
You must be signed in to change notification settings - Fork 0
/
nop_test.go
54 lines (39 loc) · 842 Bytes
/
nop_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 filecache_test
import (
"context"
"strings"
"testing"
"github.com/kukymbr/filecache/v2"
"github.com/stretchr/testify/assert"
)
func TestNopFileCache(t *testing.T) {
fc := filecache.NewNop()
{
n, err := fc.Write(context.Background(), "test", strings.NewReader(""))
assert.Equal(t, int64(0), n)
assert.NoError(t, err)
}
{
n, err := fc.WriteData(context.Background(), "test", []byte("test"))
assert.Equal(t, int64(0), n)
assert.NoError(t, err)
}
{
r, err := fc.Open(context.Background(), "test")
assert.NotNil(t, r)
assert.NoError(t, err)
}
{
data, err := fc.Read(context.Background(), "test")
assert.NotNil(t, data)
assert.NoError(t, err)
}
{
err := fc.Invalidate(context.Background(), "test")
assert.NoError(t, err)
}
{
path := fc.GetPath()
assert.NotEmpty(t, path)
}
}