Commit 65e213a7 authored by Tristan Cavelier's avatar Tristan Cavelier

jslint s3 + multi split tests

parent fd52a421
...@@ -18,10 +18,6 @@ ...@@ -18,10 +18,6 @@
], function (jIO, util, RSVP) { ], function (jIO, util, RSVP) {
"use strict"; "use strict";
var tool = {
"readBlobAsBinaryString": jIO.util.readBlobAsBinaryString
};
function reverse(promise) { function reverse(promise) {
return new RSVP.Promise(function (resolve, reject, notify) { return new RSVP.Promise(function (resolve, reject, notify) {
promise.then(reject, resolve, notify); promise.then(reject, resolve, notify);
...@@ -30,46 +26,6 @@ ...@@ -30,46 +26,6 @@
}); });
} }
/**
* sequence(thens): Promise
*
* Executes a sequence of *then* callbacks. It acts like
* `smth().then(callback).then(callback)...`. The first callback is called
* with no parameter.
*
* Elements of `thens` array can be a function or an array contaning at most
* three *then* callbacks: *onFulfilled*, *onRejected*, *onNotified*.
*
* When `cancel()` is executed, each then promises are cancelled at the same
* time.
*
* @param {Array} thens An array of *then* callbacks
* @return {Promise} A new promise
*/
function sequence(thens) {
var promises = [];
return new RSVP.Promise(function (resolve, reject, notify) {
var i;
promises[0] = new RSVP.Promise(function (resolve) {
resolve();
});
for (i = 0; i < thens.length; i += 1) {
if (Array.isArray(thens[i])) {
promises[i + 1] = promises[i].
then(thens[i][0], thens[i][1], thens[i][2]);
} else {
promises[i + 1] = promises[i].then(thens[i]);
}
}
promises[i].then(resolve, reject, notify);
}, function () {
var i;
for (i = 0; i < promises.length; i += 1) {
promises[i].cancel();
}
});
}
function unexpectedError(error) { function unexpectedError(error) {
if (error instanceof Error) { if (error instanceof Error) {
deepEqual([ deepEqual([
......
...@@ -68,8 +68,9 @@ ...@@ -68,8 +68,9 @@
"status": 204, "status": 204,
"statusText": "No Content" "statusText": "No Content"
}, "Post a new document"); }, "Post a new document");
ok(/^no_document_id_[0-9]+$/.test(uuid), "New document id should look like " + ok(/^no_document_id_[0-9]+$/.test(uuid),
"no_document_id_479658600408584 : " + uuid); "New document id should look like no_document_id_479658600408584 : " +
uuid);
shared.created_document_id = uuid; shared.created_document_id = uuid;
} }
...@@ -118,7 +119,7 @@ ...@@ -118,7 +119,7 @@
//quelle utilité à pousser le xml ? //quelle utilité à pousser le xml ?
responses.push([ responses.push([
200, 200,
{"Content-Type": "text/xml"},'' {"Content-Type": "text/xml"}, ''
]); // PROPFIND ]); // PROPFIND
return jio.allDocs(); return jio.allDocs();
} }
...@@ -294,8 +295,8 @@ ...@@ -294,8 +295,8 @@
function createAttachmentTest(answer) { function createAttachmentTest(answer) {
deepEqual(answer, { deepEqual(answer, {
"attachment": "aa", "attachment": "aa",
"digest":"sha256-9834876dcfb05cb167a5c24953eba58c4"+ "digest": "sha256-9834876dcfb05cb167a5c24953eba58c4" +
"ac89b1adf57f28f2f9d09af107ee8f0", "ac89b1adf57f28f2f9d09af107ee8f0",
"id": "a", "id": "a",
"method": "putAttachment", "method": "putAttachment",
"result": "success", "result": "success",
...@@ -313,8 +314,8 @@ ...@@ -313,8 +314,8 @@
"_attachments": { "_attachments": {
"aa": { "aa": {
"content_type": "text/plain", "content_type": "text/plain",
"digest": "sha256-38760eabb666e8e61ee628a17c4090cc5"+ "digest": "sha256-38760eabb666e8e61ee628a17c4090cc5" +
"0728e095ff24218119d51bd22475363", "0728e095ff24218119d51bd22475363",
"length": 3 "length": 3
} }
} }
...@@ -332,8 +333,8 @@ ...@@ -332,8 +333,8 @@
function updateAttachmentTest(answer) { function updateAttachmentTest(answer) {
deepEqual(answer, { deepEqual(answer, {
"attachment": "aa", "attachment": "aa",
"digest": "sha256-38760eabb666e8e61ee628a17c4090cc5"+ "digest": "sha256-38760eabb666e8e61ee628a17c4090cc5" +
"0728e095ff24218119d51bd22475363", "0728e095ff24218119d51bd22475363",
"id": "a", "id": "a",
"method": "putAttachment", "method": "putAttachment",
"result": "success", "result": "success",
...@@ -351,8 +352,8 @@ ...@@ -351,8 +352,8 @@
"_attachments": { "_attachments": {
"aa": { "aa": {
"content_type": "text/plain", "content_type": "text/plain",
"digest": "sha256-38760eabb666e8e61ee628a17c4090cc5"+ "digest": "sha256-38760eabb666e8e61ee628a17c4090cc5" +
"0728e095ff24218119d51bd22475363", "0728e095ff24218119d51bd22475363",
"length": 3 "length": 3
} }
} }
...@@ -389,8 +390,8 @@ ...@@ -389,8 +390,8 @@
"_attachments": { "_attachments": {
"aa": { "aa": {
"content_type": "text/plain", "content_type": "text/plain",
"digest": "sha256-38760eabb666e8e61ee628a17c4090cc5"+ "digest": "sha256-38760eabb666e8e61ee628a17c4090cc5" +
"0728e095ff24218119d51bd22475363", "0728e095ff24218119d51bd22475363",
"length": 3 "length": 3
}, },
"ab": { "ab": {
...@@ -424,8 +425,8 @@ ...@@ -424,8 +425,8 @@
"_attachments": { "_attachments": {
"aa": { "aa": {
"content_type": "text/plain", "content_type": "text/plain",
"digest": "sha256-38760eabb666e8e61ee628a17c4090cc5"+ "digest": "sha256-38760eabb666e8e61ee628a17c4090cc5" +
"0728e095ff24218119d51bd22475363", "0728e095ff24218119d51bd22475363",
"length": 3 "length": 3
}, },
"ab": { "ab": {
...@@ -448,8 +449,8 @@ ...@@ -448,8 +449,8 @@
deepEqual(answer, { deepEqual(answer, {
"attachment": "aa", "attachment": "aa",
"data": "<blob>", "data": "<blob>",
"digest": "sha256-38760eabb666e8e61ee628a17c4090cc5"+ "digest": "sha256-38760eabb666e8e61ee628a17c4090cc5" +
"0728e095ff24218119d51bd22475363", "0728e095ff24218119d51bd22475363",
"id": "a", "id": "a",
"method": "getAttachment", "method": "getAttachment",
"result": "success", "result": "success",
...@@ -473,8 +474,8 @@ ...@@ -473,8 +474,8 @@
"_attachments": { "_attachments": {
"aa": { "aa": {
"content_type": "text/plain", "content_type": "text/plain",
"digest": "sha256-38760eabb666e8e61ee628a17c4090cc5"+ "digest": "sha256-38760eabb666e8e61ee628a17c4090cc5" +
"0728e095ff24218119d51bd22475363", "0728e095ff24218119d51bd22475363",
"length": 3 "length": 3
}, },
"ab": { "ab": {
...@@ -522,8 +523,8 @@ ...@@ -522,8 +523,8 @@
"_attachments": { "_attachments": {
"aa": { "aa": {
"content_type": "text/plain", "content_type": "text/plain",
"digest": "sha256-38760eabb666e8e61ee628a17c4090cc5"+ "digest": "sha256-38760eabb666e8e61ee628a17c4090cc5" +
"0728e095ff24218119d51bd22475363", "0728e095ff24218119d51bd22475363",
"length": 3 "length": 3
}, },
"ab": { "ab": {
...@@ -545,8 +546,8 @@ ...@@ -545,8 +546,8 @@
"_attachments": { "_attachments": {
"aa": { "aa": {
"content_type": "text/plain", "content_type": "text/plain",
"digest": "sha256-38760eabb666e8e61ee628a17c4090cc5"+ "digest": "sha256-38760eabb666e8e61ee628a17c4090cc5" +
"0728e095ff24218119d51bd22475363", "0728e095ff24218119d51bd22475363",
"length": 3 "length": 3
}, },
"ab": { "ab": {
...@@ -574,8 +575,8 @@ ...@@ -574,8 +575,8 @@
"_attachments": { "_attachments": {
"aa": { "aa": {
"content_type": "text/plain", "content_type": "text/plain",
"digest": "sha256-38760eabb666e8e61ee628a17c4090cc5"+ "digest": "sha256-38760eabb666e8e61ee628a17c4090cc5" +
"0728e095ff24218119d51bd22475363", "0728e095ff24218119d51bd22475363",
"length": 3 "length": 3
}, },
"ab": { "ab": {
...@@ -611,8 +612,8 @@ ...@@ -611,8 +612,8 @@
"_attachments": { "_attachments": {
"aa": { "aa": {
"content_type": "text/plain", "content_type": "text/plain",
"digest": "sha256-38760eabb666e8e61ee628a17c4090cc5"+ "digest": "sha256-38760eabb666e8e61ee628a17c4090cc5" +
"0728e095ff24218119d51bd22475363", "0728e095ff24218119d51bd22475363",
"length": 3 "length": 3
} }
} }
...@@ -804,7 +805,7 @@ ...@@ -804,7 +805,7 @@
// # Post new documents, list them and remove them // # Post new documents, list them and remove them
// post a 201 // post a 201
postNewDocument().then(postNewDocumentTest). postNewDocument().then(postNewDocumentTest).
// get 200 // get 200
then(getCreatedDocument).then(getCreatedDocumentTest). then(getCreatedDocument).then(getCreatedDocumentTest).
// post b 201 // post b 201
......
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