-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10949 from qmonmert/addmissingtest2
Generator: add missing test for WindowApplicationListener
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/test/webapp/unit/shared/alert/infrastructure/primary/WindowApplicationListener.spec.ts
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,24 @@ | ||
import { WindowApplicationListener } from '@/shared/alert/infrastructure/primary/WindowApplicationListener'; | ||
import { describe, it, expect, vi } from 'vitest'; | ||
|
||
describe('WindowApplicationListener', () => { | ||
it('should add event listener on window', () => { | ||
vi.spyOn(window, 'addEventListener').mockImplementation(() => {}); | ||
|
||
const windowApplicationListener = new WindowApplicationListener(window); | ||
|
||
windowApplicationListener.addEventListener('success', () => {}); | ||
|
||
expect(window.addEventListener).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('should remove event listener on window', () => { | ||
vi.spyOn(window, 'removeEventListener').mockImplementation(() => {}); | ||
|
||
const windowApplicationListener = new WindowApplicationListener(window); | ||
|
||
windowApplicationListener.removeEventListener('success', () => {}); | ||
|
||
expect(window.removeEventListener).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
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