insomnia/packages/insomnia-app/app/common/__tests__/electron-helpers.test.ts
2022-02-02 11:21:25 -05:00

26 lines
751 B
TypeScript

import electron from 'electron';
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 */