Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Bryan Kaperick
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
Show 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 */
/*jslint indent: 2, maxlen: 90, nomen: true */
/*global define, exports, require, module, jIO,
window, test
,
/*global define, exports, require, module, jIO,
test, stop
,
raises, ok, equal, deepEqual, sinon */
raises, ok, equal, deepEqual, sinon
, test_util
*/
// define([module_name], [dependencies], module);
// define([module_name], [dependencies], module);
(
function
(
dependencies
,
module
)
{
(
function
(
dependencies
,
module
)
{
...
@@ -11,8 +11,8 @@
...
@@ -11,8 +11,8 @@
if
(
typeof
exports
===
'
object
'
)
{
if
(
typeof
exports
===
'
object
'
)
{
return
module
(
require
(
'
jio
'
));
return
module
(
require
(
'
jio
'
));
}
}
module
(
jIO
);
module
(
jIO
,
test_util
);
}([
'
jio
'
,
'
qunit
'
],
function
(
jIO
)
{
}([
'
jio
'
,
'
test_util
'
,
'
qunit
'
],
function
(
jIO
,
util
)
{
"
use strict
"
;
"
use strict
"
;
module
(
'
Key and key_schema objects validation
'
);
module
(
'
Key and key_schema objects validation
'
);
...
@@ -83,26 +83,35 @@
...
@@ -83,26 +83,35 @@
});
});
test
(
'
Check the key options
'
,
function
()
{
test
(
"
missing `key` property
"
,
function
()
{
var
doc_list
=
[
stop
();
var
start
=
util
.
starter
(
1000
),
doc_list
=
[
{
'
identifier
'
:
'
a
'
}
{
'
identifier
'
:
'
a
'
}
];
];
try
{
jIO
.
QueryFactory
.
create
({
jIO
.
QueryFactory
.
create
({
type
:
'
simple
'
,
type
:
'
simple
'
,
key
:
{},
key
:
{},
value
:
'
a
'
value
:
'
a
'
}).
exec
(
doc_list
);
}).
exec
(
doc_list
).
then
(
function
()
{
ok
(
false
,
'
key.read_from is not checked
'
);
ok
(
false
,
'
key.read_from is not checked
'
);
}
catch
(
e
)
{
start
();
},
function
(
e
)
{
equal
(
e
.
name
,
'
TypeError
'
,
'
wrong exception type
'
);
equal
(
e
.
name
,
'
TypeError
'
,
'
wrong exception type
'
);
equal
(
e
.
message
,
equal
(
e
.
message
,
"
Custom key is missing the read_from property
"
,
"
Custom key is missing the read_from property
"
,
'
wrong exception message
'
);
'
wrong exception message
'
);
}
start
();
});
});
test
(
"
`key` has unknown property
"
,
function
()
{
stop
();
var
start
=
util
.
starter
(
1000
),
doc_list
=
[
{
"
identifier
"
:
"
a
"
}
];
try
{
jIO
.
QueryFactory
.
create
({
jIO
.
QueryFactory
.
create
({
type
:
'
simple
'
,
type
:
'
simple
'
,
key
:
{
key
:
{
...
@@ -110,14 +119,16 @@
...
@@ -110,14 +119,16 @@
foobar
:
''
foobar
:
''
},
},
value
:
'
a
'
value
:
'
a
'
}).
exec
(
doc_list
);
}).
exec
(
doc_list
).
then
(
function
()
{
ok
(
false
,
'
unknown key properties are not checked
'
);
ok
(
false
,
'
unknown key properties are not checked
'
);
}
catch
(
e
)
{
start
();
},
function
(
e
)
{
equal
(
e
.
name
,
'
TypeError
'
,
'
wrong exception type
'
);
equal
(
e
.
name
,
'
TypeError
'
,
'
wrong exception type
'
);
equal
(
e
.
message
,
equal
(
e
.
message
,
"
Custom key has unknown property 'foobar'
"
,
"
Custom key has unknown property 'foobar'
"
,
'
wrong exception message
'
);
'
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