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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tomáš Peterka
jio
Commits
a18fda75
Commit
a18fda75
authored
Aug 26, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JIO tests updated
parent
f5acb674
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
25 deletions
+71
-25
test/jio/tests.js
test/jio/tests.js
+71
-25
No files found.
test/jio/tests.js
View file @
a18fda75
...
@@ -201,7 +201,9 @@
...
@@ -201,7 +201,9 @@
"
message
"
:
"
Check if the storage description respects the
"
+
"
message
"
:
"
Check if the storage description respects the
"
+
"
constraints provided by the storage designer. (TypeError:
"
+
"
constraints provided by the storage designer. (TypeError:
"
+
"
Unknown storage 'blue')
"
,
"
Unknown storage 'blue')
"
,
"
method
"
:
"
post
"
,
"
reason
"
:
"
invalid description
"
,
"
reason
"
:
"
invalid description
"
,
"
result
"
:
"
error
"
,
"
status
"
:
551
,
"
status
"
:
551
,
"
statusText
"
:
"
Internal Storage Error
"
"
statusText
"
:
"
Internal Storage Error
"
},
"
Unknown storage
"
);
},
"
Unknown storage
"
);
...
@@ -222,7 +224,9 @@
...
@@ -222,7 +224,9 @@
"
message
"
:
"
Check if the storage description respects the
"
+
"
message
"
:
"
Check if the storage description respects the
"
+
"
constraints provided by the storage designer. (TypeError:
"
+
"
constraints provided by the storage designer. (TypeError:
"
+
"
Initialization error: wrong id)
"
,
"
Initialization error: wrong id)
"
,
"
method
"
:
"
post
"
,
"
reason
"
:
"
invalid description
"
,
"
reason
"
:
"
invalid description
"
,
"
result
"
:
"
error
"
,
"
status
"
:
551
,
"
status
"
:
551
,
"
statusText
"
:
"
Internal Storage Error
"
"
statusText
"
:
"
Internal Storage Error
"
},
"
Initialization error
"
);
},
"
Initialization error
"
);
...
@@ -250,6 +254,8 @@
...
@@ -250,6 +254,8 @@
"
error
"
:
"
request_timeout
"
,
"
error
"
:
"
request_timeout
"
,
"
message
"
:
"
Operation canceled after around
"
+
"
message
"
:
"
Operation canceled after around
"
+
"
10000 milliseconds of inactivity.
"
,
"
10000 milliseconds of inactivity.
"
,
"
method
"
:
"
post
"
,
"
result
"
:
"
error
"
,
"
reason
"
:
"
timeout
"
,
"
reason
"
:
"
timeout
"
,
"
status
"
:
408
,
"
status
"
:
408
,
"
statusText
"
:
"
Request Timeout
"
"
statusText
"
:
"
Request Timeout
"
...
@@ -274,6 +280,8 @@
...
@@ -274,6 +280,8 @@
"
error
"
:
"
request_timeout
"
,
"
error
"
:
"
request_timeout
"
,
"
message
"
:
"
Operation canceled after around
"
+
"
message
"
:
"
Operation canceled after around
"
+
"
10000 milliseconds of inactivity.
"
,
"
10000 milliseconds of inactivity.
"
,
"
method
"
:
"
post
"
,
"
result
"
:
"
error
"
,
"
reason
"
:
"
timeout
"
,
"
reason
"
:
"
timeout
"
,
"
status
"
:
408
,
"
status
"
:
408
,
"
statusText
"
:
"
Request Timeout
"
"
statusText
"
:
"
Request Timeout
"
...
@@ -301,6 +309,8 @@
...
@@ -301,6 +309,8 @@
"
error
"
:
"
request_timeout
"
,
"
error
"
:
"
request_timeout
"
,
"
message
"
:
"
Operation canceled after around
"
+
"
message
"
:
"
Operation canceled after around
"
+
"
2 milliseconds of inactivity.
"
,
"
2 milliseconds of inactivity.
"
,
"
method
"
:
"
post
"
,
"
result
"
:
"
error
"
,
"
reason
"
:
"
timeout
"
,
"
reason
"
:
"
timeout
"
,
"
status
"
:
408
,
"
status
"
:
408
,
"
statusText
"
:
"
Request Timeout
"
"
statusText
"
:
"
Request Timeout
"
...
@@ -315,6 +325,8 @@
...
@@ -315,6 +325,8 @@
"
error
"
:
"
request_timeout
"
,
"
error
"
:
"
request_timeout
"
,
"
message
"
:
"
Operation canceled after around
"
+
"
message
"
:
"
Operation canceled after around
"
+
"
50 milliseconds of inactivity.
"
,
"
50 milliseconds of inactivity.
"
,
"
method
"
:
"
post
"
,
"
result
"
:
"
error
"
,
"
reason
"
:
"
timeout
"
,
"
reason
"
:
"
timeout
"
,
"
status
"
:
408
,
"
status
"
:
408
,
"
statusText
"
:
"
Request Timeout
"
"
statusText
"
:
"
Request Timeout
"
...
@@ -342,6 +354,8 @@
...
@@ -342,6 +354,8 @@
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
error
"
:
"
internal_storage_error
"
,
"
error
"
:
"
internal_storage_error
"
,
"
message
"
:
"
New document id have to be specified
"
,
"
message
"
:
"
New document id have to be specified
"
,
"
method
"
:
"
post
"
,
"
result
"
:
"
error
"
,
"
reason
"
:
"
invalid response
"
,
"
reason
"
:
"
invalid response
"
,
"
status
"
:
551
,
"
status
"
:
551
,
"
statusText
"
:
"
Internal Storage Error
"
"
statusText
"
:
"
Internal Storage Error
"
...
@@ -362,7 +376,9 @@
...
@@ -362,7 +376,9 @@
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
error
"
:
"
internal_storage_error
"
,
"
error
"
:
"
internal_storage_error
"
,
"
message
"
:
"
Unknown status
\"
undefined
\"
"
,
"
message
"
:
"
Unknown status
\"
undefined
\"
"
,
"
method
"
:
"
post
"
,
"
reason
"
:
"
invalid response
"
,
"
reason
"
:
"
invalid response
"
,
"
result
"
:
"
error
"
,
"
status
"
:
551
,
"
status
"
:
551
,
"
statusText
"
:
"
Internal Storage Error
"
"
statusText
"
:
"
Internal Storage Error
"
},
"
Invalid Post Error Response
"
);
},
"
Invalid Post Error Response
"
);
...
@@ -377,7 +393,7 @@
...
@@ -377,7 +393,7 @@
*/
*/
test
(
'
Valid Responses & Callbacks
'
,
function
()
{
test
(
'
Valid Responses & Callbacks
'
,
function
()
{
var
clock
,
jio
,
o
=
{};
var
clock
,
jio
,
o
=
{};
expect
(
7
);
expect
(
8
);
clock
=
sinon
.
useFakeTimers
();
clock
=
sinon
.
useFakeTimers
();
jio
=
new
JIO
({
jio
=
new
JIO
({
...
@@ -393,8 +409,9 @@
...
@@ -393,8 +409,9 @@
"
+ valid response.
"
;
"
+ valid response.
"
;
jio
.
post
({}).
always
(
function
(
answer
)
{
jio
.
post
({}).
always
(
function
(
answer
)
{
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
ok
"
:
true
,
"
id
"
:
"
document id a
"
,
"
id
"
:
"
document id a
"
,
"
method
"
:
"
post
"
,
"
result
"
:
"
success
"
,
"
status
"
:
201
,
"
status
"
:
201
,
"
statusText
"
:
"
Created
"
"
statusText
"
:
"
Created
"
},
o
.
message
);
},
o
.
message
);
...
@@ -408,8 +425,9 @@
...
@@ -408,8 +425,9 @@
"
fail(function (answer) {..})
"
;
"
fail(function (answer) {..})
"
;
jio
.
post
({}).
done
(
function
(
answer
)
{
jio
.
post
({}).
done
(
function
(
answer
)
{
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
ok
"
:
true
,
"
id
"
:
"
document id a
"
,
"
id
"
:
"
document id a
"
,
"
method
"
:
"
post
"
,
"
result
"
:
"
success
"
,
"
status
"
:
201
,
"
status
"
:
201
,
"
statusText
"
:
"
Created
"
"
statusText
"
:
"
Created
"
},
o
.
message
);
},
o
.
message
);
...
@@ -427,8 +445,9 @@
...
@@ -427,8 +445,9 @@
return
deepEqual
(
err
,
"
Should not fail
"
,
o
.
message
);
return
deepEqual
(
err
,
"
Should not fail
"
,
o
.
message
);
}
}
deepEqual
(
response
,
{
deepEqual
(
response
,
{
"
ok
"
:
true
,
"
id
"
:
"
document id a
"
,
"
id
"
:
"
document id a
"
,
"
method
"
:
"
post
"
,
"
result
"
:
"
success
"
,
"
status
"
:
201
,
"
status
"
:
201
,
"
statusText
"
:
"
Created
"
"
statusText
"
:
"
Created
"
},
o
.
message
);
},
o
.
message
);
...
@@ -448,8 +467,10 @@
...
@@ -448,8 +467,10 @@
deepEqual
(
err
,
{
deepEqual
(
err
,
{
"
status
"
:
409
,
"
status
"
:
409
,
"
statusText
"
:
"
Conflict
"
,
"
statusText
"
:
"
Conflict
"
,
"
method
"
:
"
post
"
,
"
error
"
:
"
conflict
"
,
"
error
"
:
"
conflict
"
,
"
reason
"
:
"
unknown
"
,
"
reason
"
:
"
unknown
"
,
"
result
"
:
"
error
"
,
"
message
"
:
""
"
message
"
:
""
},
o
.
message
);
},
o
.
message
);
});
});
...
@@ -460,10 +481,22 @@
...
@@ -460,10 +481,22 @@
// Tests getAttachment command string response
// Tests getAttachment command string response
jio
.
getAttachment
({
"
_id
"
:
"
a
"
,
"
_attachment
"
:
"
b
"
}).
jio
.
getAttachment
({
"
_id
"
:
"
a
"
,
"
_attachment
"
:
"
b
"
}).
always
(
function
(
answer
)
{
always
(
function
(
answer
)
{
ok
(
answer
instanceof
Blob
,
"
Get Attachment Command: Blob returned
"
);
deepEqual
(
JSON
.
parse
(
JSON
.
stringify
(
answer
)),
{
"
attachment
"
:
"
b
"
,
"
data
"
:
{},
"
id
"
:
"
a
"
,
"
method
"
:
"
getAttachment
"
,
"
result
"
:
"
success
"
,
"
status
"
:
200
,
"
statusText
"
:
"
Ok
"
});
ok
(
answer
.
data
instanceof
Blob
,
"
Get Attachment Command: Blob should be returned
"
);
});
});
clock
.
tick
(
1
);
clock
.
tick
(
1
);
fakestorage
[
'
Valid Resp/getAttachment
'
].
success
(
"
document id a
"
);
fakestorage
[
'
Valid Resp/getAttachment
'
].
success
(
"
ok
"
,
{
"
data
"
:
"
document id a
"
});
clock
.
tick
(
1
);
clock
.
tick
(
1
);
// Tests notify responses
// Tests notify responses
...
@@ -628,8 +661,11 @@
...
@@ -628,8 +661,11 @@
state
=
"
Called
"
;
state
=
"
Called
"
;
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
error
"
:
"
internal_server_error
"
,
"
error
"
:
"
internal_server_error
"
,
"
id
"
:
"
a
"
,
"
message
"
:
""
,
"
message
"
:
""
,
"
method
"
:
"
get
"
,
"
reason
"
:
"
unknown
"
,
"
reason
"
:
"
unknown
"
,
"
result
"
:
"
error
"
,
"
status
"
:
500
,
"
status
"
:
500
,
"
statusText
"
:
"
Internal Server Error
"
"
statusText
"
:
"
Internal Server Error
"
},
"
Error response
"
);
},
"
Error response
"
);
...
@@ -669,11 +705,12 @@
...
@@ -669,11 +705,12 @@
jio
.
get
({
"
_id
"
:
"
a
"
},
{
"
max_retry
"
:
2
,
"
timeout
"
:
12
}).
jio
.
get
({
"
_id
"
:
"
a
"
},
{
"
max_retry
"
:
2
,
"
timeout
"
:
12
}).
always
(
function
(
answer
)
{
always
(
function
(
answer
)
{
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
_
id
"
:
"
a
"
,
"
id
"
:
"
a
"
,
"
b
"
:
"
c
"
,
"
method
"
:
"
get
"
,
"
ok
"
:
true
,
"
result
"
:
"
success
"
,
"
status
"
:
200
,
"
status
"
:
200
,
"
statusText
"
:
"
Ok
"
"
statusText
"
:
"
Ok
"
,
"
data
"
:
{
"
b
"
:
"
c
"
}
},
"
Job respond
"
);
},
"
Job respond
"
);
});
});
o
.
job1
=
{
o
.
job1
=
{
...
@@ -695,7 +732,7 @@
...
@@ -695,7 +732,7 @@
},
'
Job added, workspace have one job
'
);
},
'
Job added, workspace have one job
'
);
clock
.
tick
(
1
);
// now: 1 ms
clock
.
tick
(
1
);
// now: 1 ms
fakestorage
[
"
1 Job Manage/get
"
].
success
({
"
_id
"
:
"
a
"
,
"
b
"
:
"
c
"
});
fakestorage
[
"
1 Job Manage/get
"
].
success
({
"
data
"
:
{
"
b
"
:
"
c
"
}
});
clock
.
tick
(
1
);
// now: 2 ms
clock
.
tick
(
1
);
// now: 2 ms
deepEqual
(
workspace
,
{},
'
Job ended, empty workspace
'
);
deepEqual
(
workspace
,
{},
'
Job ended, empty workspace
'
);
...
@@ -705,11 +742,12 @@
...
@@ -705,11 +742,12 @@
jio
.
get
({
"
_id
"
:
"
b
"
},
{
"
max_retry
"
:
2
,
"
timeout
"
:
12
}).
jio
.
get
({
"
_id
"
:
"
b
"
},
{
"
max_retry
"
:
2
,
"
timeout
"
:
12
}).
always
(
function
(
answer
)
{
always
(
function
(
answer
)
{
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
_
id
"
:
"
b
"
,
"
id
"
:
"
b
"
,
"
c
"
:
"
d
"
,
"
method
"
:
"
get
"
,
"
ok
"
:
true
,
"
result
"
:
"
success
"
,
"
status
"
:
200
,
"
status
"
:
200
,
"
statusText
"
:
"
Ok
"
"
statusText
"
:
"
Ok
"
,
"
data
"
:
{
"
c
"
:
"
d
"
}
},
"
First job respond
"
);
},
"
First job respond
"
);
});
});
o
.
job1
.
kwargs
.
_id
=
'
b
'
;
o
.
job1
.
kwargs
.
_id
=
'
b
'
;
...
@@ -721,11 +759,12 @@
...
@@ -721,11 +759,12 @@
"
id
"
:
"
2 Job Manage
"
"
id
"
:
"
2 Job Manage
"
}).
get
({
"
_id
"
:
"
c
"
}).
always
(
function
(
answer
)
{
}).
get
({
"
_id
"
:
"
c
"
}).
always
(
function
(
answer
)
{
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
_
id
"
:
"
c
"
,
"
id
"
:
"
c
"
,
"
d
"
:
"
e
"
,
"
method
"
:
"
get
"
,
"
ok
"
:
true
,
"
result
"
:
"
success
"
,
"
status
"
:
200
,
"
status
"
:
200
,
"
statusText
"
:
"
Ok
"
"
statusText
"
:
"
Ok
"
,
"
data
"
:
{
"
d
"
:
"
e
"
}
},
"
Second job respond
"
);
},
"
Second job respond
"
);
});
});
...
@@ -754,8 +793,8 @@
...
@@ -754,8 +793,8 @@
uniqueJSONStringify
([
o
.
job2
])
uniqueJSONStringify
([
o
.
job2
])
},
'
First Job ended, second still there
'
);
},
'
First Job ended, second still there
'
);
fakestorage
[
'
1 Job Manage/get
'
].
success
({
"
_id
"
:
"
b
"
,
"
c
"
:
"
d
"
});
fakestorage
[
'
1 Job Manage/get
'
].
success
({
"
data
"
:
{
"
c
"
:
"
d
"
}
});
fakestorage
[
'
2 Job Manage/get
'
].
success
({
"
_id
"
:
"
c
"
,
"
d
"
:
"
e
"
});
fakestorage
[
'
2 Job Manage/get
'
].
success
({
"
data
"
:
{
"
d
"
:
"
e
"
}
});
deepEqual
(
workspace
,
{},
'
No more job in the queue
'
);
deepEqual
(
workspace
,
{},
'
No more job in the queue
'
);
...
@@ -880,7 +919,8 @@
...
@@ -880,7 +919,8 @@
jio
.
put
({
"
_id
"
:
"
a
"
}).
always
(
function
(
answer
)
{
jio
.
put
({
"
_id
"
:
"
a
"
}).
always
(
function
(
answer
)
{
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
id
"
:
"
a
"
,
"
id
"
:
"
a
"
,
"
ok
"
:
true
,
"
method
"
:
"
put
"
,
"
result
"
:
"
success
"
,
"
status
"
:
200
,
"
status
"
:
200
,
"
statusText
"
:
"
Ok
"
"
statusText
"
:
"
Ok
"
},
"
First put respond
"
);
},
"
First put respond
"
);
...
@@ -894,7 +934,8 @@
...
@@ -894,7 +934,8 @@
jio
.
put
({
"
_id
"
:
"
a
"
}).
always
(
function
(
answer
)
{
jio
.
put
({
"
_id
"
:
"
a
"
}).
always
(
function
(
answer
)
{
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
id
"
:
"
a
"
,
"
id
"
:
"
a
"
,
"
ok
"
:
true
,
"
method
"
:
"
put
"
,
"
result
"
:
"
success
"
,
"
status
"
:
200
,
"
status
"
:
200
,
"
statusText
"
:
"
Ok
"
"
statusText
"
:
"
Ok
"
},
"
Second put respond
"
);
},
"
Second put respond
"
);
...
@@ -926,7 +967,8 @@
...
@@ -926,7 +967,8 @@
jio
.
put
({
"
_id
"
:
"
a
"
}).
always
(
function
(
answer
)
{
jio
.
put
({
"
_id
"
:
"
a
"
}).
always
(
function
(
answer
)
{
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
id
"
:
"
a
"
,
"
id
"
:
"
a
"
,
"
ok
"
:
true
,
"
method
"
:
"
put
"
,
"
result
"
:
"
success
"
,
"
status
"
:
200
,
"
status
"
:
200
,
"
statusText
"
:
"
Ok
"
"
statusText
"
:
"
Ok
"
},
"
First put respond
"
);
},
"
First put respond
"
);
...
@@ -940,7 +982,8 @@
...
@@ -940,7 +982,8 @@
jio
.
put
({
"
_id
"
:
"
a
"
,
"
a
"
:
"
b
"
}).
always
(
function
(
answer
)
{
jio
.
put
({
"
_id
"
:
"
a
"
,
"
a
"
:
"
b
"
}).
always
(
function
(
answer
)
{
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
id
"
:
"
a
"
,
"
id
"
:
"
a
"
,
"
ok
"
:
true
,
"
method
"
:
"
put
"
,
"
result
"
:
"
success
"
,
"
status
"
:
200
,
"
status
"
:
200
,
"
statusText
"
:
"
Ok
"
"
statusText
"
:
"
Ok
"
},
"
Second put respond
"
);
},
"
Second put respond
"
);
...
@@ -984,8 +1027,11 @@
...
@@ -984,8 +1027,11 @@
jio
.
get
({
"
_id
"
:
"
a
"
}).
always
(
function
(
answer
)
{
jio
.
get
({
"
_id
"
:
"
a
"
}).
always
(
function
(
answer
)
{
deepEqual
(
answer
,
{
deepEqual
(
answer
,
{
"
error
"
:
"
precondition_failed
"
,
"
error
"
:
"
precondition_failed
"
,
"
id
"
:
"
a
"
,
"
message
"
:
"
Command rejected by the job checker.
"
,
"
message
"
:
"
Command rejected by the job checker.
"
,
"
method
"
:
"
get
"
,
"
reason
"
:
"
command denied
"
,
"
reason
"
:
"
command denied
"
,
"
result
"
:
"
error
"
,
"
status
"
:
412
,
"
status
"
:
412
,
"
statusText
"
:
"
Precondition Failed
"
"
statusText
"
:
"
Precondition Failed
"
},
"
Get respond
"
);
},
"
Get respond
"
);
...
...
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