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
31f2d370
Commit
31f2d370
authored
Oct 24, 2017
by
samy
Browse files
Fix PR comments
parent
144ac4d2
Pipeline
#4188
passed with stage
in 40 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
+13
-10
client/lib/archive.js
client/lib/archive.js
+3
-4
client/lib/archive.test.js
client/lib/archive.test.js
+9
-5
config.json
config.json
+1
-1
No files found.
client/lib/archive.js
View file @
31f2d370
...
...
@@ -20,17 +20,16 @@
'
use strict
'
;
/* global robotLib:true
require
XMLHttpRequest */
/* global robotLib:true XMLHttpRequest */
/* exported robotController */
robotLib
.
archive
=
function
(
config
)
{
return
{
store
(
transcript
)
{
const
OpenPaasStore
=
config
.
archive
;
const
xhttp
=
new
XMLHttpRequest
();
if
(
transcript
===
undefined
)
{
return
false
;
}
xhttp
.
open
(
'
POST
'
,
OpenPaasStore
+
'
/summary
'
);
const
xhttp
=
new
XMLHttpRequest
();
xhttp
.
open
(
'
POST
'
,
config
.
archive
);
xhttp
.
setRequestHeader
(
'
Content-Type
'
,
'
application/json
'
);
xhttp
.
send
(
JSON
.
stringify
(
transcript
));
return
true
;
...
...
client/lib/archive.test.js
View file @
31f2d370
...
...
@@ -21,20 +21,24 @@
'
use strict
'
;
const
robotLib
=
{};
const
XML
HttpRequestMock
=
{
const
xml
HttpRequestMock
Factory
=
()
=>
(
{
open
:
jest
.
fn
().
mockImplementation
(()
=>
({})),
setRequestHeader
:
()
=>
{},
send
:
jest
.
fn
().
mockImplementation
(()
=>
{
return
{};
})
};
}
)
;
const
config
=
{
archive
:
'
http://
172.17.42.1:8080/api
'
archive
:
'
http://
openpaasstore.test
'
};
let
XMLHttpRequestMock
;
describe
(
'
client/lib/archive
'
,
()
=>
{
beforeEach
(()
=>
{
XMLHttpRequestMock
=
xmlHttpRequestMockFactory
();
global
.
robotLib
=
robotLib
;
global
.
XMLHttpRequest
=
function
()
{
return
XMLHttpRequestMock
;
...
...
@@ -53,7 +57,7 @@ describe('client/lib/archive', () => {
test
(
'
should make correct REST call on store
'
,
()
=>
{
const
transcript
=
{};
global
.
archive
.
store
(
transcript
);
expect
(
XMLHttpRequestMock
.
open
).
toHaveBeenCalledWith
(
'
POST
'
,
config
.
archive
+
'
/summary
'
);
expect
(
XMLHttpRequestMock
.
open
).
toHaveBeenCalledWith
(
'
POST
'
,
config
.
archive
);
expect
(
XMLHttpRequestMock
.
send
).
toHaveBeenCalled
();
});
...
...
@@ -66,6 +70,6 @@ describe('client/lib/archive', () => {
test
(
'
should not make a REST call without transcript
'
,
()
=>
{
const
transcript
=
undefined
;
global
.
archive
.
store
(
transcript
);
expect
(
XMLHttpRequestMock
.
send
).
not
.
toHaveBeenCalled
With
(
JSON
.
stringify
(
transcript
)
);
expect
(
XMLHttpRequestMock
.
send
).
not
.
toHaveBeenCalled
(
);
});
});
config.json
View file @
31f2d370
...
...
@@ -30,7 +30,7 @@
"https://cdnjs.cloudflare.com/ajax/libs/sockjs-client/1.1.4/sockjs.min.js"
,
"https://cdnjs.cloudflare.com/ajax/libs/stomp.js/2.3.3/stomp.min.js"
],
"archive"
:
"http://localhost:8080/api"
,
"archive"
:
"http://localhost:8080/api
/summary
"
,
"reco"
:
{
"host"
:
"recommender"
,
"port"
:
8080
,
...
...
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