Skip to content

Commit

Permalink
EVENT: Add new test for Move() method
Browse files Browse the repository at this point in the history
  • Loading branch information
Cian911 committed Jan 23, 2022
1 parent 8cea7e8 commit 96e92e9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions event/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ func TestEvent(t *testing.T) {
}
})

t.Run("It moves file from one dir to another dir with valid destPath", func(t *testing.T) {
event := eventSetup(t)
event.Move(fmt.Sprintf("%s/", event.Path), "")

// If the file does not exist, log an error
if _, err := os.Stat(fmt.Sprintf("%s/%s", event.Destination, event.File)); errors.Is(err, os.ErrNotExist) {
t.Fatalf("Failed to move from %s/%s to %s/%s: %v : %v", event.Path, event.File, event.Destination, event.File, err, *event)
}
})

t.Run("It does not move file from one dir to another dir", func(t *testing.T) {
event := eventSetup(t)
event.Destination = "/abcdefg"
Expand Down

0 comments on commit 96e92e9

Please sign in to comment.