Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
f3c3d0d3
Commit
f3c3d0d3
authored
Nov 26, 2021
by
Eduardo Sanz García
Committed by
Eduardo
Nov 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary test seam
parent
35f64c35
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
postmessage-json-rpc.js
src/sidebar/util/postmessage-json-rpc.js
+4
-3
postmessage-json-rpc-test.js
src/sidebar/util/test/postmessage-json-rpc-test.js
+11
-10
No files found.
src/sidebar/util/postmessage-json-rpc.js
View file @
f3c3d0d3
...
...
@@ -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'
,
...
...
src/sidebar/util/test/postmessage-json-rpc-test.js
View file @
f3c3d0d3
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'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment