2019-08-09 17:25:12 +03:00
|
|
|
const should = require('should');
|
|
|
|
const sinon = require('sinon');
|
2020-03-30 18:26:47 +03:00
|
|
|
const utils = require('../../../../../core/server/api/canary/utils');
|
2019-08-09 17:25:12 +03:00
|
|
|
|
|
|
|
describe('Unit: canary/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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|