2018-04-25 13:27:39 +03:00
|
|
|
const should = require('should'),
|
|
|
|
sinon = require('sinon'),
|
|
|
|
models = require('../../../server/models'),
|
|
|
|
testUtils = require('../../utils'),
|
2019-01-21 19:53:44 +03:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|