[MM-40330] Unit tests for main/windows (#1885)
* [MM-40330] Unit tests for main/windows * Merge'd
This commit is contained in:
@@ -6,7 +6,7 @@ import {app} from 'electron';
|
||||
|
||||
import * as Badge from './badge';
|
||||
|
||||
import {setOverlayIcon} from './windows/windowManager';
|
||||
import WindowManager from './windows/windowManager';
|
||||
|
||||
jest.mock('electron', () => ({
|
||||
app: {
|
||||
@@ -28,28 +28,28 @@ describe('main/badge', () => {
|
||||
describe('showBadgeWindows', () => {
|
||||
it('should show dot when session expired', () => {
|
||||
Badge.showBadgeWindows(true, 7, false);
|
||||
expect(setOverlayIcon).toBeCalledWith('•', expect.any(String), expect.any(Boolean));
|
||||
expect(WindowManager.setOverlayIcon).toBeCalledWith('•', expect.any(String), expect.any(Boolean));
|
||||
});
|
||||
|
||||
it('should show mention count when has mention count', () => {
|
||||
Badge.showBadgeWindows(false, 50, false);
|
||||
expect(setOverlayIcon).toBeCalledWith('50', expect.any(String), false);
|
||||
expect(WindowManager.setOverlayIcon).toBeCalledWith('50', expect.any(String), false);
|
||||
});
|
||||
|
||||
it('should show 99+ when has mention count over 99', () => {
|
||||
Badge.showBadgeWindows(false, 200, false);
|
||||
expect(setOverlayIcon).toBeCalledWith('99+', expect.any(String), true);
|
||||
expect(WindowManager.setOverlayIcon).toBeCalledWith('99+', expect.any(String), true);
|
||||
});
|
||||
|
||||
it('should not show dot when has unreads but setting is off', () => {
|
||||
Badge.showBadgeWindows(false, 0, true);
|
||||
expect(setOverlayIcon).not.toBeCalledWith('•', expect.any(String), expect.any(Boolean));
|
||||
expect(WindowManager.setOverlayIcon).not.toBeCalledWith('•', expect.any(String), expect.any(Boolean));
|
||||
});
|
||||
|
||||
it('should show dot when has unreads', () => {
|
||||
Badge.setUnreadBadgeSetting(true);
|
||||
Badge.showBadgeWindows(false, 0, true);
|
||||
expect(setOverlayIcon).toBeCalledWith('•', expect.any(String), expect.any(Boolean));
|
||||
expect(WindowManager.setOverlayIcon).toBeCalledWith('•', expect.any(String), expect.any(Boolean));
|
||||
Badge.setUnreadBadgeSetting(false);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user