Skip to content

Commit

Permalink
Added test file
Browse files Browse the repository at this point in the history
  • Loading branch information
SakizciAdam committed Feb 27, 2022
1 parent 6fa32f7 commit 8a2428b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions eventemitter_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package eventemitter_test

import (
"testing"

"github.com/SakizciAdam/eventemitter"
)

func TestEventBus(t *testing.T) {
bus := eventemitter.New()

bus.AddListener("test", func(args ...interface{}) {
if len(args) != 1 {
t.Errorf("Expected 1 argument, got %d", len(args))
}

if args[0] != "hello" {
t.Errorf("Expected 'test', got '%s'", args[0])
}
})

bus.EmitSync("test", "hello")
}

0 comments on commit 8a2428b

Please sign in to comment.