mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
parent
1b5ac28faf
commit
1bcd25fdbf
@ -86,13 +86,12 @@ db = {
|
||||
|
||||
function deleteContent() {
|
||||
var collections = [
|
||||
models.Subscriber.findAll(queryOpts),
|
||||
models.Post.findAll(queryOpts),
|
||||
models.Tag.findAll(queryOpts)
|
||||
];
|
||||
|
||||
return Promise.each(collections, function then(Collection) {
|
||||
return Collection.invokeThen('destroy');
|
||||
return Collection.invokeThen('destroy', queryOpts);
|
||||
}).return({db: []})
|
||||
.catch(function (err) {
|
||||
throw new errors.GhostError({err: err});
|
||||
|
@ -2,8 +2,7 @@ var should = require('should'),
|
||||
testUtils = require('../../utils'),
|
||||
_ = require('lodash'),
|
||||
dbAPI = require('../../../server/api/db'),
|
||||
ModelTag = require('../../../server/models/tag'),
|
||||
ModelPost = require('../../../server/models/post');
|
||||
models = require('../../../server/models');
|
||||
|
||||
describe('DB API', function () {
|
||||
// Keep the DB clean
|
||||
@ -19,15 +18,20 @@ describe('DB API', function () {
|
||||
result.db.should.be.instanceof(Array);
|
||||
result.db.should.be.empty();
|
||||
}).then(function () {
|
||||
return ModelTag.Tag.findAll(testUtils.context.owner).then(function (results) {
|
||||
return models.Tag.findAll(testUtils.context.owner).then(function (results) {
|
||||
should.exist(results);
|
||||
results.length.should.equal(0);
|
||||
});
|
||||
}).then(function () {
|
||||
return ModelPost.Post.findAll(testUtils.context.owner).then(function (results) {
|
||||
return models.Post.findAll(testUtils.context.owner).then(function (results) {
|
||||
should.exist(results);
|
||||
results.length.should.equal(0);
|
||||
});
|
||||
}).then(function () {
|
||||
return models.Subscriber.findAll(testUtils.context.owner).then(function (results) {
|
||||
should.exist(results);
|
||||
results.length.should.equal(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -37,12 +41,12 @@ describe('DB API', function () {
|
||||
result.db.should.be.instanceof(Array);
|
||||
result.db.should.be.empty();
|
||||
}).then(function () {
|
||||
return ModelTag.Tag.findAll(testUtils.context.admin).then(function (results) {
|
||||
return models.Tag.findAll(testUtils.context.admin).then(function (results) {
|
||||
should.exist(results);
|
||||
results.length.should.equal(0);
|
||||
});
|
||||
}).then(function () {
|
||||
return ModelPost.Post.findAll(testUtils.context.admin).then(function (results) {
|
||||
return models.Post.findAll(testUtils.context.admin).then(function (results) {
|
||||
should.exist(results);
|
||||
results.length.should.equal(0);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user