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
Vincent Bechu
jio
Commits
0a307d7f
Commit
0a307d7f
authored
Apr 22, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
key typechecks synchronous tests error fix
parent
84107abc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
25 deletions
+36
-25
test/queries/key-typechecks.tests.js
test/queries/key-typechecks.tests.js
+36
-25
No files found.
test/queries/key-typechecks.tests.js
View file @
0a307d7f
/*jslint indent: 2, maxlen: 90, nomen: true */
/*global define, exports, require, module, jIO,
window, test
,
raises, ok, equal, deepEqual, sinon */
/*global define, exports, require, module, jIO,
test, stop
,
raises, ok, equal, deepEqual, sinon
, test_util
*/
// define([module_name], [dependencies], module);
(
function
(
dependencies
,
module
)
{
...
...
@@ -11,8 +11,8 @@
if
(
typeof
exports
===
'
object
'
)
{
return
module
(
require
(
'
jio
'
));
}
module
(
jIO
);
}([
'
jio
'
,
'
qunit
'
],
function
(
jIO
)
{
module
(
jIO
,
test_util
);
}([
'
jio
'
,
'
test_util
'
,
'
qunit
'
],
function
(
jIO
,
util
)
{
"
use strict
"
;
module
(
'
Key and key_schema objects validation
'
);
...
...
@@ -83,41 +83,52 @@
});
test
(
'
Check the key options
'
,
function
()
{
var
doc_list
=
[
test
(
"
missing `key` property
"
,
function
()
{
stop
();
var
start
=
util
.
starter
(
1000
),
doc_list
=
[
{
'
identifier
'
:
'
a
'
}
];
try
{
jIO
.
QueryFactory
.
create
({
type
:
'
simple
'
,
key
:
{},
value
:
'
a
'
}).
exec
(
doc_list
);
jIO
.
QueryFactory
.
create
({
type
:
'
simple
'
,
key
:
{},
value
:
'
a
'
}).
exec
(
doc_list
).
then
(
function
()
{
ok
(
false
,
'
key.read_from is not checked
'
);
}
catch
(
e
)
{
start
();
},
function
(
e
)
{
equal
(
e
.
name
,
'
TypeError
'
,
'
wrong exception type
'
);
equal
(
e
.
message
,
"
Custom key is missing the read_from property
"
,
'
wrong exception message
'
);
}
start
();
});
try
{
jIO
.
QueryFactory
.
create
({
type
:
'
simple
'
,
key
:
{
read_from
:
'
identifier
'
,
foobar
:
''
},
value
:
'
a
'
}).
exec
(
doc_list
);
});
test
(
"
`key` has unknown property
"
,
function
()
{
stop
();
var
start
=
util
.
starter
(
1000
),
doc_list
=
[
{
"
identifier
"
:
"
a
"
}
];
jIO
.
QueryFactory
.
create
({
type
:
'
simple
'
,
key
:
{
read_from
:
'
identifier
'
,
foobar
:
''
},
value
:
'
a
'
}).
exec
(
doc_list
).
then
(
function
()
{
ok
(
false
,
'
unknown key properties are not checked
'
);
}
catch
(
e
)
{
start
();
},
function
(
e
)
{
equal
(
e
.
name
,
'
TypeError
'
,
'
wrong exception type
'
);
equal
(
e
.
message
,
"
Custom key has unknown property 'foobar'
"
,
'
wrong exception message
'
);
}
start
();
});
});
}));
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