-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers_test.go
39 lines (30 loc) · 913 Bytes
/
helpers_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
package bfs_test
import (
"context"
"github.com/bsm/bfs"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Helpers", func() {
var bucket *bfs.InMem
var ctx = context.Background()
BeforeEach(func() {
bucket = bfs.NewInMem()
})
It("should write objects", func() {
err := bfs.WriteObject(ctx, bucket, "path/to/file", []byte("testdata"), nil)
Expect(err).NotTo(HaveOccurred())
Expect(bucket.ObjectSizes()).
To(HaveKeyWithValue("path/to/file", int64(8)))
})
It("should copy objects", func() {
err := bfs.WriteObject(ctx, bucket, "src.txt", []byte("testdata"), nil)
Expect(err).NotTo(HaveOccurred())
err = bfs.CopyObject(ctx, bucket, "src.txt", "dst.txt", nil)
Expect(err).NotTo(HaveOccurred())
Expect(bucket.ObjectSizes()).
To(HaveKeyWithValue("src.txt", int64(8)))
Expect(bucket.ObjectSizes()).
To(HaveKeyWithValue("dst.txt", int64(8)))
})
})