2018-11-06 17:36:22 +05:30
|
|
|
const should = require('should');
|
|
|
|
const sinon = require('sinon');
|
2020-03-30 16:26:47 +01:00
|
|
|
const utils = require('../../../../../core/server/api/v2/utils');
|
2018-11-06 17:36:22 +05:30
|
|
|
|
|
|
|
describe('Unit: v2/utils/index', function () {
|
|
|
|
afterEach(function () {
|
2019-01-21 17:53:44 +01:00
|
|
|
sinon.restore();
|
2018-11-06 17:36:22 +05:30
|
|
|
});
|
2019-01-28 10:03:57 +01:00
|
|
|
|
2018-11-06 17:36:22 +05:30
|
|
|
describe('isContentAPI', function () {
|
2019-02-14 18:17:02 +01:00
|
|
|
it('is true when apiType is "content"', function () {
|
2018-11-06 17:36:22 +05:30
|
|
|
const frame = {
|
2019-02-14 18:17:02 +01:00
|
|
|
apiType: 'content'
|
2018-11-06 17:36:22 +05:30
|
|
|
};
|
|
|
|
should(utils.isContentAPI(frame)).equal(true);
|
|
|
|
});
|
|
|
|
|
2019-02-25 19:52:45 +01:00
|
|
|
it('is false when apiType is admin', function () {
|
2018-11-06 17:36:22 +05:30
|
|
|
const frame = {
|
2019-02-14 18:17:02 +01:00
|
|
|
apiType: 'admin',
|
2018-11-06 17:36:22 +05:30
|
|
|
options: {
|
|
|
|
context: {
|
2019-02-14 18:17:02 +01:00
|
|
|
no: 'public'
|
2018-11-06 17:36:22 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2019-02-14 18:17:02 +01:00
|
|
|
should(utils.isContentAPI(frame)).equal(false);
|
2018-11-06 17:36:22 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|