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