Skip to content

Commit b11a10f

Browse files
committed
Fix system tests to support metacom
Closes: #152 PR-URL: #161
1 parent f25528e commit b11a10f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/system.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ const PORT = 8000;
1111
const START_TIMEOUT = 1000;
1212
const TEST_TIMEOUT = 3000;
1313

14+
let callId = 0;
15+
1416
console.log('System test started');
1517
setTimeout(async () => {
1618
worker.postMessage({ name: 'stop' });
@@ -24,8 +26,9 @@ const tasks = [
2426
{ get: '/', status: 302 },
2527
{ get: '/console.js' },
2628
{
27-
post: '/api/signIn',
28-
data: { login: 'marcus', password: 'marcus' }
29+
post: '/api',
30+
method: 'signIn',
31+
args: { login: 'marcus', password: 'marcus' }
2932
}
3033
];
3134

@@ -42,8 +45,9 @@ const getRequest = task => {
4245
request.method = 'POST';
4346
request.path = task.post;
4447
}
45-
if (task.data) {
46-
task.data = JSON.stringify(task.data);
48+
if (task.args) {
49+
const packet = { call: ++callId, [task.method]: task.args };
50+
task.data = JSON.stringify(packet);
4751
request.headers = {
4852
'Content-Type': 'application/json',
4953
'Content-Length': task.data.length

0 commit comments

Comments
 (0)