Skip to content

Commit

Permalink
filled in tests for setText
Browse files Browse the repository at this point in the history
  • Loading branch information
FireLemons committed Oct 7, 2023
1 parent effe696 commit 8ac598c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/javascript/__tests__/notifier.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,13 @@ describe('Notifications', () => {
test('changes the text of the notification', (done) => {
$(() => {
try {
expect(notificationsElement[0].innerHTML).toContain(notificationDefaultMessage)

const newNotificationMessage = 'VOr%%:#Vc*tbNbM}iUT}'

notification.setText(newNotificationMessage)

expect(notification.notificationElement.text()).toContain(newNotificationMessage)
done()
} catch (error) {
done(error)
Expand All @@ -517,6 +524,12 @@ describe('Notifications', () => {
test('throws an error if the notification has been dismissed', (done) => {
$(() => {
try {
notification.notificationElement.remove()
expect(notificationsElement[0].innerHTML).not.toContain(notificationDefaultMessage)

expect(() => {
notification.setText('new Text')
}).toThrow(ReferenceError)
done()
} catch (error) {
done(error)
Expand Down

0 comments on commit 8ac598c

Please sign in to comment.