Commit 1d22cda3 authored by Marco Mariani's avatar Marco Mariani

cleanup after docs/ merge; renamed test modules

parent c0381741
......@@ -4,6 +4,7 @@ QUERIES_DIR = src/queries
# files
JIO = jio.js
JIO_MIN = jio.min.js
JIODATE_MIN = jiodate.min.js
COMPLEX = complex_queries.js
COMPLEX_MIN = complex_queries.min.js
PARSER_PAR = $(QUERIES_DIR)/core/parser.par
......@@ -90,6 +91,7 @@ clean:
realclean:
rm -f "$(JIO)"
rm -f "$(JIO_MIN)"
rm -f "$(JIODATE_MIN)"
rm -f "$(COMPLEX)"
rm -f "$(COMPLEX_MIN)"
rm -f "$(PARSER_OUT)"
......@@ -5,7 +5,7 @@
### Getting Started
To setup you should jIO include jio.js, dependencies and the connectors for the storages
To set up jIO you should include jio.js, dependencies and the connectors for the storages
you want to use in the HTML page header (note that more dependencies may be required
depending on type of storages being used):
......
......@@ -15,7 +15,7 @@
}(['complex_queries', 'jiodate', 'qunit'], function (complex_queries, jiodate) {
"use strict";
module('JIODate with custom keys');
module('Custom Key Queries with JIODate');
test('Stock comparison operators with year precision', function () {
var doc_list, docList = function () {
......
......@@ -15,6 +15,8 @@
}(['complex_queries', 'qunit'], function (complex_queries) {
"use strict";
module('Custom Key Queries with Schema');
var translationEqualityMatcher = function (data) {
return function (object_value, value) {
value = data[value];
......@@ -87,9 +89,6 @@
/*jslint unparam: false*/
module('Queries with Key Schema');
test('Keys defined in a Schema can be used like metadata', function () {
var doc_list, docList = function () {
return [
......@@ -247,6 +246,7 @@
], 'Key Schema: It should be possible to look for a translated string with operator =');
// XXX not implemented yet
// doc_list = docList();
// complex_queries.QueryFactory.create({
// type: 'simple',
......@@ -258,8 +258,6 @@
// {'identifier': '2', 'state': 'closed'}
// ], 'Key Schema: It should be possible to look for a translated string with operator !=');
});
}));
/*jslint indent: 2, maxlen: 120, nomen: true, vars: true */
/*global define, exports, require, module, complex_queries, jiodate, window, test, ok,
equal, deepEqual, sinon */
// define([module_name], [dependencies], module);
(function (dependencies, module) {
"use strict";
if (typeof define === 'function' && define.amd) {
return define(dependencies, module);
}
if (typeof exports === 'object') {
return module(require('complex_queries'), require('jiodate'));
}
module(complex_queries, jiodate);
}(['complex_queries', 'jiodate', 'qunit'], function (complex_queries, jiodate) {
"use strict";
module('Custom keys: fallback to < and = for missing operators');
test('Stock comparison operators with year precision', function () {
var doc_list, docList = function () {
return [
{'identifier': 'twenty ten', 'date': '2010-03-04T08:52:13.746Z'},
{'identifier': 'twenty eleven', 'date': '2011-03-04T08:52:13.746Z'},
{'identifier': 'twenty twelve', 'date': '2012-03-04T08:52:13.746Z'}
];
}, key_schema = {
key_set: {
date: {
read_from: 'date',
cast_to: jiodate.JIODate
}
}
};
jiodate.JIODate.prototype.ne = undefined;
jiodate.JIODate.prototype.le = undefined;
jiodate.JIODate.prototype.gt = undefined;
jiodate.JIODate.prototype.ge = undefined;
doc_list = docList();
complex_queries.QueryFactory.create({
type: 'simple',
key: 'date',
value: '2011'
}, key_schema).exec(doc_list);
deepEqual(doc_list, [
{'date': '2011-03-04T08:52:13.746Z', 'identifier': 'twenty eleven'}
], 'Match with "date = 2011" (query tree form)');
doc_list = docList();
complex_queries.QueryFactory.create({
type: 'simple',
key: 'date',
operator: '!=',
value: '2011'
}, key_schema).exec(doc_list);
deepEqual(doc_list, [
{'date': '2010-03-04T08:52:13.746Z', 'identifier': 'twenty ten'},
{'date': '2012-03-04T08:52:13.746Z', 'identifier': 'twenty twelve'}
], 'Match with "date != 2011" (query tree form)');
doc_list = docList();
complex_queries.QueryFactory.create({
type: 'simple',
key: 'date',
operator: '<',
value: '2011'
}, key_schema).exec(doc_list);
deepEqual(doc_list, [
{'date': '2010-03-04T08:52:13.746Z', 'identifier': 'twenty ten'}
], 'Match with "date < 2011" (query tree form)');
doc_list = docList();
complex_queries.QueryFactory.create({
type: 'simple',
key: 'date',
operator: '<=',
value: '2011'
}, key_schema).exec(doc_list);
deepEqual(doc_list, [
{'date': '2010-03-04T08:52:13.746Z', 'identifier': 'twenty ten'},
{'date': '2011-03-04T08:52:13.746Z', 'identifier': 'twenty eleven'}
], 'Match with "date <= 2011" (query tree form)');
doc_list = docList();
complex_queries.QueryFactory.create({
type: 'simple',
key: 'date',
operator: '>',
value: '2011'
}, key_schema).exec(doc_list);
deepEqual(doc_list, [
{'date': '2012-03-04T08:52:13.746Z', 'identifier': 'twenty twelve'}
], 'Match with "date > 2011" (query tree form)');
doc_list = docList();
complex_queries.QueryFactory.create({
type: 'simple',
key: 'date',
operator: '>=',
value: '2011'
}, key_schema).exec(doc_list);
deepEqual(doc_list, [
{'date': '2011-03-04T08:52:13.746Z', 'identifier': 'twenty eleven'},
{'date': '2012-03-04T08:52:13.746Z', 'identifier': 'twenty twelve'}
], 'Match with "date >= 2011" (query tree form)');
});
}));
......@@ -19,7 +19,7 @@
<script src="jio/tests.js"></script>
<script src="../complex_queries.js"></script>
<script src="queries/keys.tests.js"></script>
<script src="queries/key.tests.js"></script>
<script src="queries/key-schema.tests.js"></script>
<script src="queries/tests.js"></script>
<script src="queries/key-typechecks.tests.js"></script>
......@@ -27,11 +27,10 @@
<script src="../lib/moment/moment-2.5.0.js"></script>
<script src="../src/jio.date/jiodate.js"></script>
<script src="queries/jiodate.tests.js"></script>
<script src="queries/jiodate.key.tests.js"></script>
<script src="queries/keys.eq-lt.tests.js"></script>
<script src="queries/key-jiodate.tests.js"></script>
<script src="../src/jio.storage/localstorage.js"></script>
<script src="queries/localstorage-keys.tests.js"></script>
<script src="queries/key-localstorage.tests.js"></script>
<script src="jio.storage/localstorage.tests.js"></script>
<script src="../src/jio.storage/davstorage.js"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment