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
Xiaohe Cao
jio
Commits
0b8d4e96
Commit
0b8d4e96
authored
Dec 28, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jiotests tools updated
parent
f19a4f95
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
20 deletions
+44
-20
test/jiotests.js
test/jiotests.js
+42
-20
test/jiotests_withoutrequirejs.html
test/jiotests_withoutrequirejs.html
+2
-0
No files found.
test/jiotests.js
View file @
0b8d4e96
...
@@ -123,30 +123,44 @@ generateTools = function (sinon) {
...
@@ -123,30 +123,44 @@ generateTools = function (sinon) {
o
.
clock
.
tick
(
base_tick
);
o
.
clock
.
tick
(
base_tick
);
o
.
spy
=
basicSpyFunction
;
o
.
spy
=
basicSpyFunction
;
o
.
tick
=
basicTickFunction
;
o
.
tick
=
basicTickFunction
;
// test methods
o
.
testLastJobLabel
=
function
(
label
,
mess
)
{
o
.
testLastJobLabel
=
function
(
label
,
mess
)
{
deepEqual
(
var
lastjob
=
getLastJob
(
o
.
jio
.
getId
());
getLastJob
(
o
.
jio
.
getId
()).
command
.
label
,
if
(
lastjob
)
{
label
,
deepEqual
(
lastjob
.
command
.
label
,
label
,
mess
);
mess
}
else
{
);
deepEqual
(
"
No job on the queue
"
,
"
Job with label:
"
+
label
,
mess
);
}
};
};
o
.
testLastJobId
=
function
(
id
,
mess
)
{
o
.
testLastJobId
=
function
(
id
,
mess
)
{
deepEqual
(
var
lastjob
=
getLastJob
(
o
.
jio
.
getId
());
getLastJob
(
o
.
jio
.
getId
()).
id
,
if
(
lastjob
)
{
id
,
deepEqual
(
lastjob
.
id
,
id
,
mess
);
mess
}
else
{
);
deepEqual
(
"
No job on the queue
"
,
"
Job with id:
"
+
id
,
mess
);
}
};
};
o
.
testLastJobWaitForTime
=
function
(
mess
)
{
o
.
testLastJobWaitForTime
=
function
(
mess
)
{
ok
(
getLastJob
(
o
.
jio
.
getId
()).
status
.
waitfortime
>
0
,
mess
);
var
lastjob
=
getLastJob
(
o
.
jio
.
getId
());
if
(
lastjob
)
{
ok
(
lastjob
.
status
.
waitfortime
>
0
,
mess
);
}
else
{
deepEqual
(
"
No job on the queue
"
,
"
Job waiting for time
"
,
mess
);
}
};
};
o
.
testLastJobWaitForJob
=
function
(
job_id_array
,
mess
)
{
o
.
testLastJobWaitForJob
=
function
(
job_id_array
,
mess
)
{
deepEqual
(
var
lastjob
=
getLastJob
(
o
.
jio
.
getId
());
getLastJob
(
o
.
jio
.
getId
()).
status
.
waitforjob
,
if
(
lastjob
)
{
job_id_array
,
deepEqual
(
lastjob
.
status
.
waitforjob
,
job_id_array
,
mess
);
mess
}
else
{
);
deepEqual
(
"
No job on the queue
"
,
"
Job waiting for:
"
+
JSON
.
stringify
(
job_id_array
),
mess
);
}
};
};
// wait method
o
.
waitUntilAJobExists
=
function
(
timeout
)
{
o
.
waitUntilAJobExists
=
function
(
timeout
)
{
var
cpt
=
0
var
cpt
=
0
while
(
true
)
{
while
(
true
)
{
...
@@ -154,7 +168,7 @@ generateTools = function (sinon) {
...
@@ -154,7 +168,7 @@ generateTools = function (sinon) {
break
;
break
;
}
}
if
(
timeout
>=
cpt
)
{
if
(
timeout
>=
cpt
)
{
ok
(
false
,
"
no job
added to the queue
"
);
ok
(
false
,
"
No job were
added to the queue
"
);
break
;
break
;
}
}
o
.
clock
.
tick
(
25
);
o
.
clock
.
tick
(
25
);
...
@@ -164,7 +178,7 @@ generateTools = function (sinon) {
...
@@ -164,7 +178,7 @@ generateTools = function (sinon) {
o
.
waitUntilLastJobIs
=
function
(
state
)
{
o
.
waitUntilLastJobIs
=
function
(
state
)
{
while
(
true
)
{
while
(
true
)
{
if
(
getLastJob
(
o
.
jio
.
getId
())
===
undefined
)
{
if
(
getLastJob
(
o
.
jio
.
getId
())
===
undefined
)
{
ok
(
false
,
"
a job is never called
"
);
ok
(
false
,
"
No job have state:
"
+
state
);
break
;
break
;
}
}
if
(
getLastJob
(
o
.
jio
.
getId
()).
status
.
label
===
state
)
{
if
(
getLastJob
(
o
.
jio
.
getId
()).
status
.
label
===
state
)
{
...
@@ -174,10 +188,18 @@ generateTools = function (sinon) {
...
@@ -174,10 +188,18 @@ generateTools = function (sinon) {
}
}
};
};
return
o
;
return
o
;
}
;
}
,
//// end tools
//// end tools
//// test methods ////
//// test function
isUuid
=
function
(
uuid
)
{
var
x
=
"
[0-9a-fA-F]{4}
"
;
if
(
typeof
uuid
!==
"
string
"
)
{
return
false
;
}
return
uuid
.
match
(
"
^
"
+
x
+
x
+
"
-
"
+
x
+
"
-
"
+
x
+
"
-
"
+
x
+
"
-
"
+
x
+
x
+
x
+
"
$
"
)
===
null
?
false
:
true
;
};
//// QUnit Tests ////
//// QUnit Tests ////
module
(
'
Jio Global tests
'
);
module
(
'
Jio Global tests
'
);
...
...
test/jiotests_withoutrequirejs.html
View file @
0b8d4e96
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
<script
type=
"text/javascript"
src=
"../lib/jsSha2/sha2.js"
></script>
<script
type=
"text/javascript"
src=
"../lib/jsSha2/sha2.js"
></script>
<script
type=
"text/javascript"
src=
"../src/jio.dummystorages.js"
></script>
<script
type=
"text/javascript"
src=
"../src/jio.dummystorages.js"
></script>
<script
type=
"text/javascript"
src=
"../jio.storage.js"
></script>
<script
type=
"text/javascript"
src=
"../jio.storage.js"
></script>
<script
type=
"text/javascript"
src=
"../src/jio.storage/revisionstorage.js"
>
</script>
<script
type=
"text/javascript"
src=
"./jiotests.js"
></script>
<script
type=
"text/javascript"
src=
"./jiotests.js"
></script>
</body>
</body>
</html>
</html>
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