-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfs-make-dir_test.go
82 lines (69 loc) · 2.03 KB
/
fs-make-dir_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package nef_test
import (
"fmt"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ok
. "github.com/onsi/gomega" //nolint:revive // ok
nef "github.com/snivilised/nefilim"
lab "github.com/snivilised/nefilim/internal/laboratory"
"github.com/snivilised/nefilim/test/luna"
)
var _ = Describe("op: make-dir/all", Ordered, func() {
var root string
BeforeAll(func() {
root = luna.Repo("test")
})
Context("tentative", func() {
Context("fs: MakeDirFS", func() {
var (
fS nef.MakeDirFS
)
BeforeEach(func() {
fS = nef.NewMakeDirFS(nef.Rel{
Root: root,
Overwrite: false,
})
Expect(fS.IsRelative()).To(BeTrue())
scratch(root)
})
Context("op: MakeDir", func() {
When("given: path does not exist", func() {
It("🧪 should: complete ok", func() {
path := lab.Static.FS.Scratch
Expect(fS.MakeDir(path, lab.Perms.Dir.Perm())).To(
Succeed(), fmt.Sprintf("failed to MakeDir %q", path),
)
Expect(luna.AsDirectory(path)).To(luna.ExistInFS(fS))
})
})
When("given: path already exists", func() {
It("🧪 should: complete ok", func() {
path := lab.Static.FS.Existing.Directory
Expect(fS.MakeDir(path, lab.Perms.Dir.Perm())).To(
Succeed(), fmt.Sprintf("failed to MakeDir %q", path),
)
})
})
})
Context("op: MakeDirAll", func() {
When("given: path does not exist", func() {
It("🧪 should: complete ok", func() {
path := lab.Static.FS.MakeDir.MakeAll
Expect(fS.MakeDirAll(path, lab.Perms.Dir.Perm())).To(
Succeed(), fmt.Sprintf("failed to MakeDir %q", path),
)
Expect(luna.AsDirectory(path)).To(luna.ExistInFS(fS))
})
})
When("given: path already exists", func() {
It("🧪 should: complete ok", func() {
path := lab.Static.FS.Existing.Directory
Expect(fS.MakeDir(path, lab.Perms.Dir.Perm())).To(
Succeed(), fmt.Sprintf("failed to MakeDir %q", path),
)
Expect(luna.AsDirectory(path)).To(luna.ExistInFS(fS))
})
})
})
})
})
})