Commit 205247b1 authored by Romain Courteaud's avatar Romain Courteaud

Activate unionStorage tests

parent 8a7f3c76
......@@ -23,7 +23,7 @@
* @class UnionStorage
*/
(function (jIO) {
(function (jIO, RSVP) {
"use strict";
/**
......@@ -179,4 +179,4 @@
jIO.addStorage('union', UnionStorage);
}(jIO));
}(jIO, RSVP));
......@@ -87,6 +87,35 @@
Storage500.prototype.post = generateError;
jIO.addStorage('unionstorage500', Storage500);
/////////////////////////////////////////////////////////////////
// unionStorage.constructor
/////////////////////////////////////////////////////////////////
module("unionStorage.constructor");
test("no storage list", function () {
var jio = jIO.createJIO({
type: "union",
storage_list: []
});
deepEqual(jio.__storage._storage_list, []);
});
test("initialize storage list", function () {
var jio = jIO.createJIO({
type: "union",
storage_list: [{
type: "unionstorage404"
}, {
type: "unionstorage200"
}]
});
equal(jio.__storage._storage_list.length, 2);
ok(jio.__storage._storage_list[0] instanceof jio.constructor);
equal(jio.__storage._storage_list[0].__type, "unionstorage404");
ok(jio.__storage._storage_list[1] instanceof jio.constructor);
equal(jio.__storage._storage_list[1].__type, "unionstorage200");
});
/////////////////////////////////////////////////////////////////
// unionStorage.get
......@@ -135,6 +164,7 @@
jio.get({"_id": "bar"})
.then(function (result) {
deepEqual(result, {
"_id": "bar",
"title": "foo"
}, "Check document");
})
......@@ -162,6 +192,7 @@
jio.get({"_id": "bar"})
.then(function (result) {
deepEqual(result, {
"_id": "bar",
"title": "foo"
}, "Check document");
})
......@@ -449,7 +480,7 @@
// unionStorage.hasCapacity
/////////////////////////////////////////////////////////////////
module("unionStorage.hasCapacity");
test("hasCapacity list without storage", function () {
test("Supported capacity without storage", function () {
var jio = jIO.createJIO({
type: "union",
......@@ -457,6 +488,8 @@
});
ok(jio.hasCapacity("list"));
ok(jio.hasCapacity("query"));
ok(jio.hasCapacity("select"));
});
test("hasCapacity list not implemented in substorage", function () {
......@@ -477,7 +510,8 @@
function (error) {
ok(error instanceof jIO.util.jIOError);
equal(error.status_code, 501);
equal(error.message, "Capacity 'list' is not implemented");
equal(error.message,
"Capacity 'list' is not implemented on 'unionstorage404'");
return true;
}
);
......@@ -515,7 +549,7 @@
function (error) {
ok(error instanceof jIO.util.jIOError);
equal(error.status_code, 501);
equal(error.message, "Capacity 'sort' is not implemented");
equal(error.message, "Capacity 'sort' is not implemented on 'union'");
return true;
}
);
......@@ -622,7 +656,8 @@
})
.fail(function (error) {
ok(error instanceof jIO.util.jIOError);
equal(error.message, "Capacity 'list' is not implemented");
equal(error.message,
"Capacity 'list' is not implemented on 'unionstorage500'");
equal(error.status_code, 501);
})
.fail(function (error) {
......
......@@ -31,8 +31,7 @@
<script src="jio.storage/documentstorage.tests.js"></script>
<script src="jio.storage/davstorage.tests.js"></script>
<script src="jio.storage/drivetojiomapping.tests.js"></script>
<!--script src="jio.storage/unionstorage.tests.js"></script-->
<script src="jio.storage/unionstorage.tests.js"></script>
<!--script src="jio.storage/indexeddbstorage.tests.js"></script-->
<!--script src="jio.storage/indexstorage.tests.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