mirror of
https://github.com/finos/SymphonyElectron.git
synced 2026-07-29 15:55:55 -05:00
Typescript - Remove unwanted checks in protocol handler and add test cases
This commit is contained in:
@@ -72,4 +72,24 @@ describe('protocol handler', () => {
|
||||
expect(spy).toBeCalled();
|
||||
});
|
||||
|
||||
it('should invoke `sendProtocol` when `setPreloadWebContents` is called and protocolUri is valid', () => {
|
||||
protocolHandlerInstance.preloadWebContents = { send: jest.fn() };
|
||||
protocolHandlerInstance.protocolUri = 'symphony://?userId=123456';
|
||||
|
||||
const spy: jest.SpyInstance = jest.spyOn(protocolHandlerInstance, 'sendProtocol');
|
||||
|
||||
protocolHandlerInstance.setPreloadWebContents({ send: jest.fn() });
|
||||
expect(spy).toBeCalledWith('symphony://?userId=123456');
|
||||
});
|
||||
|
||||
it('should not invoke `sendProtocol` when `setPreloadWebContents` is called and protocolUri is invalid', () => {
|
||||
protocolHandlerInstance.preloadWebContents = { send: jest.fn() };
|
||||
protocolHandlerInstance.protocolUri = null;
|
||||
|
||||
const spy: jest.SpyInstance = jest.spyOn(protocolHandlerInstance, 'sendProtocol');
|
||||
|
||||
protocolHandlerInstance.setPreloadWebContents({ send: jest.fn() });
|
||||
expect(spy).not.toBeCalled();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user