2021-05-12 20:20:52 +00:00
|
|
|
import electron from 'electron';
|
2021-07-22 23:04:56 +00:00
|
|
|
|
2021-05-12 20:20:52 +00:00
|
|
|
import { clickLink } from '../electron-helpers';
|
|
|
|
|
|
|
|
/* eslint-disable no-restricted-properties */
|
|
|
|
describe('clickLink', () => {
|
|
|
|
it('should allow http links', () => {
|
|
|
|
const url = 'http://mockbin.org';
|
|
|
|
clickLink(url);
|
|
|
|
expect(electron.shell.openExternal).toHaveBeenCalledWith(url);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should allow https links', () => {
|
|
|
|
const url = 'https://mockbin.org';
|
|
|
|
clickLink(url);
|
|
|
|
expect(electron.shell.openExternal).toHaveBeenCalledWith(url);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not allow smb links', () => {
|
|
|
|
const url = 'file:///C:/windows/system32/calc.exe';
|
|
|
|
clickLink(url);
|
|
|
|
expect(electron.shell.openExternal).not.toHaveBeenCalledWith(url);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
/* eslint-enable no-restricted-properties */
|