2019-09-03 10:03:31 +03:00
|
|
|
const should = require('should');
|
|
|
|
const sinon = require('sinon');
|
2021-01-21 12:00:25 +03:00
|
|
|
const utils = require('../../../../../core/server/api/v3/utils');
|
2019-09-03 10:03:31 +03:00
|
|
|
|
|
|
|
describe('Unit: v3/utils/index', function () {
|
|
|
|
afterEach(function () {
|
|
|
|
sinon.restore();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('isContentAPI', function () {
|
|
|
|
it('is true when apiType is "content"', function () {
|
|
|
|
const frame = {
|
|
|
|
apiType: 'content'
|
|
|
|
};
|
|
|
|
should(utils.isContentAPI(frame)).equal(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('is false when apiType is admin', function () {
|
|
|
|
const frame = {
|
|
|
|
apiType: 'admin',
|
|
|
|
options: {
|
|
|
|
context: {
|
|
|
|
no: 'public'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
should(utils.isContentAPI(frame)).equal(false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|