Conditions | 6 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | package timeago |
||
18 | func TestIsFilePresent(t *testing.T) { |
||
19 | t.Run("isFilePresent return false if file doesn't exist", func(test *testing.T) { |
||
20 | res, _ := isFilePresent("somerandompath") |
||
21 | |||
22 | if res { |
||
23 | t.Error("isFilePresent must return false, because filepath points to a file that doesn't exist") |
||
24 | } |
||
25 | }) |
||
26 | |||
27 | t.Run("isFilePresent return true if file exist", func(test *testing.T) { |
||
28 | ok, err := isFilePresent("timeago.go") |
||
29 | |||
30 | if err != nil { |
||
31 | t.Errorf("isFilePresent must return true, because filepath points to a file that exists, but returned error %v", err) |
||
32 | } |
||
33 | |||
34 | if !ok { |
||
35 | t.Error("isFilePresent must return true, because filepath points to a file that exists") |
||
36 | } |
||
52 |