mirror of
https://github.com/strapi/strapi.git
synced 2025-07-31 21:09:39 +00:00
Improved logic for tests to pass
This commit is contained in:
parent
675c19219b
commit
15e2b96fc6
@ -40,6 +40,10 @@ describe('Admin Controller', () => {
|
|||||||
const result = await adminController.init();
|
const result = await adminController.init();
|
||||||
|
|
||||||
expect(global.strapi.config.get).toHaveBeenCalledWith('uuid', false);
|
expect(global.strapi.config.get).toHaveBeenCalledWith('uuid', false);
|
||||||
|
expect(global.strapi.config.get).toHaveBeenCalledWith(
|
||||||
|
'packageJsonStrapi.telemetryDisabled',
|
||||||
|
null
|
||||||
|
);
|
||||||
expect(global.strapi.admin.services.user.exists).toHaveBeenCalled();
|
expect(global.strapi.admin.services.user.exists).toHaveBeenCalled();
|
||||||
expect(result.data).toBeDefined();
|
expect(result.data).toBeDefined();
|
||||||
expect(result.data).toStrictEqual({
|
expect(result.data).toStrictEqual({
|
||||||
|
@ -39,8 +39,13 @@ module.exports = {
|
|||||||
async init() {
|
async init() {
|
||||||
let uuid = strapi.config.get('uuid', false);
|
let uuid = strapi.config.get('uuid', false);
|
||||||
const hasAdmin = await getService('user').exists();
|
const hasAdmin = await getService('user').exists();
|
||||||
const telemetryDisabled = strapi.config.get('packageJsonStrapi.telemetryDisabled', false);
|
// set to null if telemetryDisabled flag not avaialble in package.json
|
||||||
if (telemetryDisabled) uuid = null;
|
const telemetryDisabled = strapi.config.get('packageJsonStrapi.telemetryDisabled', null);
|
||||||
|
|
||||||
|
if (telemetryDisabled !== null && telemetryDisabled === true) {
|
||||||
|
uuid = false;
|
||||||
|
}
|
||||||
|
|
||||||
return { data: { uuid, hasAdmin } };
|
return { data: { uuid, hasAdmin } };
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user