mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
5921d9ce4a
refs #9178 ## Rule - do not use the database in unit tests - re-add correct unit tests if you work on something which is not tested properly (we have to bring them back at some point, but without using the database)
29 lines
766 B
JavaScript
29 lines
766 B
JavaScript
const should = require('should'),
|
|
sinon = require('sinon'),
|
|
models = require('../../../server/models'),
|
|
testUtils = require('../../utils'),
|
|
configUtils = require('../../utils/configUtils');
|
|
|
|
describe('Unit: models/permission', function () {
|
|
before(function () {
|
|
models.init();
|
|
});
|
|
|
|
after(function () {
|
|
sinon.restore();
|
|
configUtils.restore();
|
|
});
|
|
|
|
describe('add', function () {
|
|
it('[error] validation', function () {
|
|
return models.Permission.add({})
|
|
.then(function () {
|
|
'Should fail'.should.be.true();
|
|
})
|
|
.catch(function (err) {
|
|
err.length.should.eql(3);
|
|
});
|
|
});
|
|
});
|
|
});
|