Ejemplo n.º 1
0
 it('rejects when dismissed', () => {
   ipcMain.once.mockImplementation((channel, cb) => {
     if (channel === 'PairingCodeDismissed') { cb(); }
   });
   const res = outOfBandDelegate.pairingDidBeginWithRequest({ pairingCode });
   expect(res.promise).rejects.toMatchErrorMessage(ErrorMessages.PairingCancelledByUser);
   expect(ipcMain.removeListener).toHaveBeenCalledTimes(2);
 });
Ejemplo n.º 2
0
 it('resolves with the pairing request when acknowledged', () => {
   ipcMain.once.mockImplementation((channel, cb) => {
     if (channel === 'PairingCodeAcknowledged') { cb(); }
   });
   const res = outOfBandDelegate.pairingDidBeginWithRequest({ pairingCode });
   expect(res.promise).resolves.toMatchObject({ pairingCode });
   expect(ipcMain.removeListener).toHaveBeenCalledTimes(2);
 });