2020-04-29 18:44:27 +03:00
|
|
|
const should = require('should');
|
|
|
|
const sinon = require('sinon');
|
|
|
|
const models = require('../../../core/server/models');
|
|
|
|
const testUtils = require('../../utils');
|
|
|
|
const configUtils = require('../../utils/configUtils');
|
2018-04-25 13:27:39 +03:00
|
|
|
|
|
|
|
describe('Unit: models/permission', function () {
|
|
|
|
before(function () {
|
|
|
|
models.init();
|
|
|
|
});
|
|
|
|
|
|
|
|
after(function () {
|
2019-01-21 19:53:44 +03:00
|
|
|
sinon.restore();
|
2018-06-12 21:26:16 +03:00
|
|
|
configUtils.restore();
|
2018-04-25 13:27:39 +03:00
|
|
|
});
|
|
|
|
|
2018-06-12 21:26:16 +03:00
|
|
|
describe('add', function () {
|
2018-04-25 13:27:39 +03:00
|
|
|
it('[error] validation', function () {
|
|
|
|
return models.Permission.add({})
|
|
|
|
.then(function () {
|
|
|
|
'Should fail'.should.be.true();
|
|
|
|
})
|
|
|
|
.catch(function (err) {
|
|
|
|
err.length.should.eql(3);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|