From aef6f44cb52a540c31b36b517bc88178a4a9ec3a Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 2 Dec 2014 17:26:16 -0800 Subject: [PATCH] [Persistence] Add empty specs Add empty specs for CouchDB adapter. WTD-537. --- .../src/CouchPersistenceProvider.js | 10 +++++++--- .../persistence/test/CouchDocumentSpec.js | 15 ++++++++++++++ .../test/CouchPersistenceProviderSpec.js | 20 +++++++++++++++++++ platform/persistence/test/suite.json | 4 ++++ 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 platform/persistence/test/CouchDocumentSpec.js create mode 100644 platform/persistence/test/CouchPersistenceProviderSpec.js create mode 100644 platform/persistence/test/suite.json diff --git a/platform/persistence/src/CouchPersistenceProvider.js b/platform/persistence/src/CouchPersistenceProvider.js index 06928b8327..0f0cc8d83e 100644 --- a/platform/persistence/src/CouchPersistenceProvider.js +++ b/platform/persistence/src/CouchPersistenceProvider.js @@ -9,10 +9,14 @@ define( var spaces = [ SPACE ], revs = {}; + // Convert a subpath to a full path, suitable to pass + // to $http. function url(subpath) { return PATH + '/' + subpath; } + // Issue a request using $http; get back the plain JS object + // from the expected JSON response function request(subpath, method, value) { return $http({ method: method, @@ -25,7 +29,7 @@ define( }); } - // Shorthand methods for various get types + // Shorthand methods for various HTTP methods function get(subpath) { return request(subpath, "GET"); } @@ -76,11 +80,11 @@ define( return get(key).then(getModel); }, updateObject: function (space, key, value) { - return put(key, new CouchDocument(key, value, true)) + return put(key, new CouchDocument(key, value, revs[key])) .then(checkResponse); }, deleteObject: function (space, key, value) { - return put(key, new CouchDocument(key, value, true, true)) + return put(key, new CouchDocument(key, value, revs[key], true)) .then(checkResponse); } }; diff --git a/platform/persistence/test/CouchDocumentSpec.js b/platform/persistence/test/CouchDocumentSpec.js new file mode 100644 index 0000000000..8daee1e948 --- /dev/null +++ b/platform/persistence/test/CouchDocumentSpec.js @@ -0,0 +1,15 @@ +/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ + +/** + * DomainObjectProviderSpec. Created by vwoeltje on 11/6/14. + */ +define( + ["../src/CouchDocument"], + function (CouchDocument) { + "use strict"; + + describe("A couch document", function () { + + }); + } +); \ No newline at end of file diff --git a/platform/persistence/test/CouchPersistenceProviderSpec.js b/platform/persistence/test/CouchPersistenceProviderSpec.js new file mode 100644 index 0000000000..a9826a6b1e --- /dev/null +++ b/platform/persistence/test/CouchPersistenceProviderSpec.js @@ -0,0 +1,20 @@ +/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ + +/** + * DomainObjectProviderSpec. Created by vwoeltje on 11/6/14. + */ +define( + ["../src/CouchPersistenceProvider"], + function (CouchPersistenceProvider) { + "use strict"; + + describe("The couch persistence provider", function () { + var mockHttp, + mockQ, + testSpace = "testSpace", + testPath = "/test/db", + provider; + + }); + } +); \ No newline at end of file diff --git a/platform/persistence/test/suite.json b/platform/persistence/test/suite.json new file mode 100644 index 0000000000..9df76a4c55 --- /dev/null +++ b/platform/persistence/test/suite.json @@ -0,0 +1,4 @@ +[ + "CouchDocument", + "CouchPersistenceProvider" +] \ No newline at end of file