mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 05:07:52 +00:00
[Persistence] Add empty specs
Add empty specs for CouchDB adapter. WTD-537.
This commit is contained in:
parent
4646896ac8
commit
aef6f44cb5
@ -9,10 +9,14 @@ define(
|
|||||||
var spaces = [ SPACE ],
|
var spaces = [ SPACE ],
|
||||||
revs = {};
|
revs = {};
|
||||||
|
|
||||||
|
// Convert a subpath to a full path, suitable to pass
|
||||||
|
// to $http.
|
||||||
function url(subpath) {
|
function url(subpath) {
|
||||||
return PATH + '/' + 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) {
|
function request(subpath, method, value) {
|
||||||
return $http({
|
return $http({
|
||||||
method: method,
|
method: method,
|
||||||
@ -25,7 +29,7 @@ define(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shorthand methods for various get types
|
// Shorthand methods for various HTTP methods
|
||||||
function get(subpath) {
|
function get(subpath) {
|
||||||
return request(subpath, "GET");
|
return request(subpath, "GET");
|
||||||
}
|
}
|
||||||
@ -76,11 +80,11 @@ define(
|
|||||||
return get(key).then(getModel);
|
return get(key).then(getModel);
|
||||||
},
|
},
|
||||||
updateObject: function (space, key, value) {
|
updateObject: function (space, key, value) {
|
||||||
return put(key, new CouchDocument(key, value, true))
|
return put(key, new CouchDocument(key, value, revs[key]))
|
||||||
.then(checkResponse);
|
.then(checkResponse);
|
||||||
},
|
},
|
||||||
deleteObject: function (space, key, value) {
|
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);
|
.then(checkResponse);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
15
platform/persistence/test/CouchDocumentSpec.js
Normal file
15
platform/persistence/test/CouchDocumentSpec.js
Normal file
@ -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 () {
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
20
platform/persistence/test/CouchPersistenceProviderSpec.js
Normal file
20
platform/persistence/test/CouchPersistenceProviderSpec.js
Normal file
@ -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;
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
4
platform/persistence/test/suite.json
Normal file
4
platform/persistence/test/suite.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[
|
||||||
|
"CouchDocument",
|
||||||
|
"CouchPersistenceProvider"
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user