-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add testcases for event and changes on various files:
- Loading branch information
1 parent
28b2d9e
commit f68b69b
Showing
5 changed files
with
32 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { DispatchableListener } from "../../src/listener"; | ||
import { DispatchableEvent } from "../../src/event"; | ||
|
||
describe('Dispatchable Event Suit', () => { | ||
test('setName() set event name', () => { | ||
const dispatchableEvent = new DispatchableEvent('new-event'); | ||
dispatchableEvent.setName('new-event-name'); | ||
expect(typeof dispatchableEvent.setName).toBe('function'); | ||
expect(dispatchableEvent.getName()).toBe('new-event-name'); | ||
}); | ||
|
||
test('getName() return event name', () => { | ||
const dispatchableEvent = new DispatchableEvent('new-event'); | ||
expect(typeof dispatchableEvent.getName).toBe('function'); | ||
expect(dispatchableEvent.getName()).toBe('new-event'); | ||
}); | ||
|
||
test('setListener() set listener in event', () => { | ||
const dispatchableEvent = new DispatchableEvent('new-event'); | ||
const listener = new DispatchableListener((args) => { | ||
return {} | ||
}); | ||
dispatchableEvent.setListener(listener); | ||
|
||
expect(typeof dispatchableEvent.setListener).toBe('function'); | ||
expect(dispatchableEvent.getListeners().length).toBe(1); | ||
}); | ||
}) |