Skip to content

Commit

Permalink
SPECS: Add specs for events.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cian911 committed Dec 15, 2021
1 parent e26c2ee commit 8184697
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions event/event_test.go
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
package event

import "testing"

var (
event = &Event{
File: "readme.txt",
Path: "/input",
Destination: "/output",
Ext: ".txt",
Operation: "CREATE",
}

ext = ".txt"
)

func TestEvent(t *testing.T) {
t.Run("It returns true when event is valid", func(t *testing.T) {
want := true
got := event.IsValidEvent(ext)

if want != got {
t.Errorf("event extension is not valid, when it should have been: want=%t, got=%t", want, got)
}
})

t.Run("It returns false when event is valid", func(t *testing.T) {
want := false
got := event.IsValidEvent(".mp4")

if want != got {
t.Errorf("event extension is not valid, when it should have been: want=%t, got=%t", want, got)
}
})
}

0 comments on commit 8184697

Please sign in to comment.