Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LINAGORA
L
LGS
Labs
hublot
Commits
e43a7748
Commit
e43a7748
authored
Oct 30, 2017
by
Yoann HOUPERT
Browse files
add server disconnect function
parent
ed8dc251
Pipeline
#4485
passed with stage
in 49 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
lib/controller.js
lib/controller.js
+9
-0
lib/controller.test.js
lib/controller.test.js
+25
-1
No files found.
lib/controller.js
View file @
e43a7748
...
...
@@ -36,6 +36,15 @@ const create = (runner, modules, config) => {
room
,
config
.
client
);
return
controller
.
registry
[
room
];
},
forceDisconnect
:
room
=>
{
controller
.
registry
[
room
].
execute
(()
=>
{
/* eslint-disable no-undef */
robot
.
stop
();
/* eslint-enable */
}).
end
();
delete
controller
.
registry
[
room
];
}
};
return
controller
;
...
...
lib/controller.test.js
View file @
e43a7748
...
...
@@ -24,8 +24,19 @@ const {create} = require('./controller.js');
// Here are some needed mocks
const
functionRunnerMock
=
{
execute
()
{
return
{
end
()
{
}
};
}
};
const
runnerMock
=
{
run
:
()
=>
{}
run
:
()
=>
{
return
functionRunnerMock
;
}
};
const
configMock
=
{
...
...
@@ -60,4 +71,17 @@ describe('controller', () => {
controller
.
client
(
'
test
'
);
expect
(
controller
.
registry
).
toHaveProperty
(
'
test
'
,
client1
);
});
test
(
'
should not have any room in registry when the client is disconnect
'
,
()
=>
{
controller
.
client
(
'
test
'
);
controller
.
forceDisconnect
(
'
test
'
);
expect
(
controller
.
registry
).
toEqual
({});
});
test
(
'
should have a room in registry when one client disconnect
'
,
()
=>
{
controller
.
client
(
'
test1
'
);
const
client2
=
controller
.
client
(
'
test2
'
);
controller
.
forceDisconnect
(
'
test1
'
);
expect
(
controller
.
registry
).
toHaveProperty
(
'
test2
'
,
client2
);
});
});
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