Commit f3c3d0d3 authored by Eduardo Sanz García's avatar Eduardo Sanz García Committed by Eduardo

Remove unnecessary test seam

parent 35f64c35
......@@ -18,7 +18,6 @@ function createTimeout(delay, message) {
* @param {any[]} params - Parameters of the JSON-RPC method
* @param {number} [timeout] - Maximum time to wait in ms
* @param {Window} [window_] - Test seam.
* @param {string} [id] - Test seam.
* @return {Promise<any>} - A Promise for the response to the call
*/
export function call(
......@@ -27,9 +26,11 @@ export function call(
method,
params = [],
timeout = 2000,
window_ = window,
id = generateHexString(10)
/* istanbul ignore next */
window_ = window
) {
const id = generateHexString(10);
// Send RPC request.
const request = {
jsonrpc: '2.0',
......
import EventEmitter from 'tiny-emitter';
import { call } from '../postmessage-json-rpc';
import { call, $imports } from '../postmessage-json-rpc';
class FakeWindow {
constructor() {
......@@ -19,20 +19,21 @@ describe('sidebar/util/postmessage-json-rpc', () => {
let fakeWindow;
function doCall(timeout = 1) {
return call(
frame,
origin,
'testMethod',
[1, 2, 3],
timeout,
fakeWindow,
messageId
);
return call(frame, origin, 'testMethod', [1, 2, 3], timeout, fakeWindow);
}
beforeEach(() => {
frame = { postMessage: sinon.stub() };
fakeWindow = new FakeWindow();
$imports.$mock({
'../../shared/random': {
generateHexString: sinon.stub().returns(messageId),
},
});
});
afterEach(() => {
$imports.$restore();
});
it('sends a message to the target frame', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment