-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a lot of the changes on my branch had not passed through the prettier workflow yet, this should hopefully be the last prettifying change on this branch, as I will keep up with the formatting as I edit from here forward
- Loading branch information
Abby Wheelis
committed
Nov 2, 2023
1 parent
8764701
commit 4393362
Showing
8 changed files
with
278 additions
and
225 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import { publish, subscribe, unsubscribe } from "../js/customEventHandler"; | ||
import { mockLogger } from "../__mocks__/globalMocks"; | ||
import { publish, subscribe, unsubscribe } from '../js/customEventHandler'; | ||
import { mockLogger } from '../__mocks__/globalMocks'; | ||
|
||
mockLogger(); | ||
|
||
it('subscribes and publishes to an event', () => { | ||
const listener = jest.fn(); | ||
subscribe("test", listener); | ||
publish("test", "test data"); | ||
subscribe('test', listener); | ||
publish('test', 'test data'); | ||
expect(listener).toHaveBeenCalledWith( | ||
expect.objectContaining({ | ||
type: "test", | ||
detail: "test data", | ||
}) | ||
type: 'test', | ||
detail: 'test data', | ||
}), | ||
); | ||
}) | ||
}); | ||
|
||
it('can unsubscribe', () => { | ||
const listener = jest.fn(); | ||
subscribe("test", listener); | ||
unsubscribe("test", listener); | ||
publish("test", "test data"); | ||
subscribe('test', listener); | ||
unsubscribe('test', listener); | ||
publish('test', 'test data'); | ||
expect(listener).not.toHaveBeenCalled(); | ||
}) | ||
}); |
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
Oops, something went wrong.