Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
jio
Commits
101fd0ba
Commit
101fd0ba
authored
Mar 09, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Make it more readable by using promise
parent
b53e74be
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
38 deletions
+23
-38
test/jio/util.js
test/jio/util.js
+23
-38
No files found.
test/jio/util.js
View file @
101fd0ba
...
@@ -17,15 +17,15 @@
...
@@ -17,15 +17,15 @@
* See COPYING file for full licensing terms.
* See COPYING file for full licensing terms.
* See https://www.nexedi.com/licensing for rationale and options.
* See https://www.nexedi.com/licensing for rationale and options.
*/
*/
/*global setTimeout*/
(
function
(
jIO
,
QUnit
)
{
(
function
(
jIO
,
QUnit
,
setTimeout
)
{
"
use strict
"
;
"
use strict
"
;
var
test
=
QUnit
.
test
,
var
test
=
QUnit
.
test
,
equal
=
QUnit
.
equal
,
equal
=
QUnit
.
equal
,
stop
=
QUnit
.
stop
,
stop
=
QUnit
.
stop
,
start
=
QUnit
.
start
,
start
=
QUnit
.
start
,
expect
=
QUnit
.
expect
,
expect
=
QUnit
.
expect
,
module
=
QUnit
.
module
;
module
=
QUnit
.
module
,
ok
=
QUnit
.
ok
;
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// util.stringify
// util.stringify
...
@@ -55,44 +55,29 @@
...
@@ -55,44 +55,29 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// util.ajax
// util.ajax
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
module
(
"
util.ajax
"
,
{
module
(
"
util.ajax
"
);
setup
:
function
()
{
var
context
=
this
;
this
.
jioerror
=
jIO
.
util
.
jIOError
;
this
.
error_spy
=
{};
function
fakejIOError
(
message
,
status_code
)
{
context
.
error_spy
.
message
=
message
;
context
.
error_spy
.
status_code
=
status_code
;
}
fakejIOError
.
prototype
=
new
Error
();
fakejIOError
.
prototype
.
constructor
=
fakejIOError
;
jIO
.
util
.
jIOError
=
fakejIOError
;
},
teardown
:
function
()
{
jIO
.
util
.
jIOError
=
this
.
jioerror
;
}
});
test
(
"
ajax timeout
"
,
function
()
{
test
(
"
ajax timeout
"
,
function
()
{
var
timeout
=
1
,
var
timeout
=
1
;
context
=
this
;
stop
();
stop
();
expect
(
2
);
expect
(
3
);
jIO
.
util
.
ajax
({
return
new
RSVP
.
Queue
()
.
then
(
function
()
{
return
jIO
.
util
.
ajax
({
type
:
'
GET
'
,
type
:
'
GET
'
,
url
:
"
//www.foo
/com/bar
"
,
url
:
"
https://www.example.org
/com/bar
"
,
timeout
:
timeout
timeout
:
timeout
});
});
})
setTimeout
(
function
()
{
.
fail
(
function
(
error
)
{
ok
(
error
instanceof
jIO
.
util
.
jIOError
);
equal
(
error
.
message
,
"
Gateway Timeout
"
);
equal
(
error
.
status_code
,
504
);
})
.
always
(
function
()
{
start
();
start
();
equal
(
context
.
error_spy
.
message
,
"
Gateway Timeout
"
);
equal
(
context
.
error_spy
.
status_code
,
504
);
},
10
);
});
});
}(
jIO
,
QUnit
,
setTimeout
));
});
\ No newline at end of file
}(
jIO
,
QUnit
));
\ No newline at end of file
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