Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
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
Hardik Juneja
jio-main
Commits
1e504c3c
Commit
1e504c3c
authored
Aug 21, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Asynchrony tests added
parent
97ab0228
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
test/jio/tests.js
test/jio/tests.js
+38
-0
No files found.
test/jio/tests.js
View file @
1e504c3c
...
...
@@ -140,6 +140,44 @@
deepEqual
(
result
,
"
No error thrown
"
,
"
Good parameter
"
);
});
/**
* Tests asynchrony
*/
test
(
"
Asynchrony
"
,
function
()
{
var
workspace
=
{},
clock
,
jio
,
count
=
0
;
expect
(
8
);
clock
=
sinon
.
useFakeTimers
();
jio
=
new
JIO
({
"
type
"
:
"
fake
"
,
"
id
"
:
"
Asynchrony
"
},
{
"
workspace
"
:
workspace
});
jio
.
post
({}).
done
(
function
()
{
count
+=
1
;
deepEqual
(
count
,
6
,
"
Command done
"
);
}).
progress
(
function
()
{
count
+=
1
;
deepEqual
(
count
,
3
,
"
Command notifiy
"
);
});
count
+=
1
;
deepEqual
(
count
,
1
,
"
JIO post
"
);
ok
(
!
fakestorage
[
'
Asynchrony/post
'
],
"
Command not called yet
"
);
clock
.
tick
(
1
);
count
+=
1
;
deepEqual
(
count
,
2
,
"
Next instructions
"
);
ok
(
fakestorage
[
'
Asynchrony/post
'
],
"
Command called
"
);
fakestorage
[
'
Asynchrony/post
'
].
notify
();
count
+=
1
;
deepEqual
(
count
,
4
,
"
Next timer
"
);
fakestorage
[
'
Asynchrony/post
'
].
success
({
"
id
"
:
"
a
"
});
count
+=
1
;
deepEqual
(
count
,
5
,
"
Command success requested
"
);
clock
.
tick
(
1
);
});
/**
* Tests a storage initialization error
*/
...
...
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