-
Notifications
You must be signed in to change notification settings - Fork 31
/
ftpfileinfo_test.go
60 lines (49 loc) · 1.46 KB
/
ftpfileinfo_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
package graval
import (
. "github.com/smartystreets/goconvey/convey"
"os"
"testing"
"time"
)
func TestNewDirInfo(t *testing.T) {
modTime := time.Unix(1566738000, 0) // 2019-08-25 13:00:00 UTC
dirInfo := NewDirItem("dir", modTime)
Convey("New Directory Info", t, func() {
Convey("Will display the correct Mode", func() {
So(dirInfo.Mode(), ShouldEqual, os.ModeDir|0666)
})
Convey("Will display the correct Name", func() {
So(dirInfo.Name(), ShouldEqual, "dir")
})
Convey("Will display a size of 0 bytes", func() {
So(dirInfo.Size(), ShouldEqual, 0)
})
Convey("Will display modified date as current time", func() {
So(dirInfo.ModTime(), ShouldEqual, modTime)
})
Convey("Will return nil for Sys", func() {
So(dirInfo.Sys(), ShouldBeNil)
})
})
}
func TestNewFileInfo(t *testing.T) {
modTime := time.Unix(1566738000, 0) // 2019-08-25 13:00:00 UTC
dirInfo := NewFileItem("test.txt", int64(99), modTime)
Convey("New File Info", t, func() {
Convey("Will display the correct Mode", func() {
So(dirInfo.Mode(), ShouldEqual, 0666)
})
Convey("Will display the correct Name", func() {
So(dirInfo.Name(), ShouldEqual, "test.txt")
})
Convey("Will display a size of 0 bytes", func() {
So(dirInfo.Size(), ShouldEqual, 99)
})
Convey("Will display modified date as current time", func() {
So(dirInfo.ModTime(), ShouldEqual, modTime)
})
Convey("Will return nil for Sys", func() {
So(dirInfo.Sys(), ShouldBeNil)
})
})
}