feat: expose installationCompleted in GET /v1/automatisch/info
This commit is contained in:
@@ -1,13 +1,17 @@
|
|||||||
import appConfig from '../../../../config/app.js';
|
import appConfig from '../../../../config/app.js';
|
||||||
import { hasValidLicense } from '../../../../helpers/license.ee.js';
|
import { hasValidLicense } from '../../../../helpers/license.ee.js';
|
||||||
import { renderObject } from '../../../../helpers/renderer.js';
|
import { renderObject } from '../../../../helpers/renderer.js';
|
||||||
|
import Config from '../../../../models/config.js';
|
||||||
|
|
||||||
export default async (request, response) => {
|
export default async (request, response) => {
|
||||||
|
const installationCompleted = await Config.isInstallationCompleted();
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
isCloud: appConfig.isCloud,
|
|
||||||
isMation: appConfig.isMation,
|
|
||||||
isEnterprise: await hasValidLicense(),
|
|
||||||
docsUrl: appConfig.docsUrl,
|
docsUrl: appConfig.docsUrl,
|
||||||
|
installationCompleted,
|
||||||
|
isCloud: appConfig.isCloud,
|
||||||
|
isEnterprise: await hasValidLicense(),
|
||||||
|
isMation: appConfig.isMation,
|
||||||
};
|
};
|
||||||
|
|
||||||
renderObject(response, info);
|
renderObject(response, info);
|
||||||
|
@@ -1,12 +1,14 @@
|
|||||||
import { vi, expect, describe, it } from 'vitest';
|
import { vi, expect, describe, it } from 'vitest';
|
||||||
import request from 'supertest';
|
import request from 'supertest';
|
||||||
import appConfig from '../../../../config/app.js';
|
import appConfig from '../../../../config/app.js';
|
||||||
|
import Config from '../../../../models/config.js';
|
||||||
import app from '../../../../app.js';
|
import app from '../../../../app.js';
|
||||||
import infoMock from '../../../../../test/mocks/rest/api/v1/automatisch/info.js';
|
import infoMock from '../../../../../test/mocks/rest/api/v1/automatisch/info.js';
|
||||||
import * as license from '../../../../helpers/license.ee.js';
|
import * as license from '../../../../helpers/license.ee.js';
|
||||||
|
|
||||||
describe('GET /api/v1/automatisch/info', () => {
|
describe('GET /api/v1/automatisch/info', () => {
|
||||||
it('should return Automatisch info', async () => {
|
it('should return Automatisch info', async () => {
|
||||||
|
vi.spyOn(Config, 'isInstallationCompleted').mockResolvedValue(true);
|
||||||
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(false);
|
vi.spyOn(appConfig, 'isCloud', 'get').mockReturnValue(false);
|
||||||
vi.spyOn(appConfig, 'isMation', 'get').mockReturnValue(false);
|
vi.spyOn(appConfig, 'isMation', 'get').mockReturnValue(false);
|
||||||
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
vi.spyOn(license, 'hasValidLicense').mockResolvedValue(true);
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
const infoMock = () => {
|
const infoMock = () => {
|
||||||
return {
|
return {
|
||||||
data: {
|
data: {
|
||||||
isCloud: false,
|
|
||||||
isMation: false,
|
|
||||||
isEnterprise: true,
|
|
||||||
docsUrl: 'https://automatisch.io/docs',
|
docsUrl: 'https://automatisch.io/docs',
|
||||||
|
installationCompleted: true,
|
||||||
|
isCloud: false,
|
||||||
|
isEnterprise: true,
|
||||||
|
isMation: false,
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
count: 1,
|
count: 1,
|
||||||
|
Reference in New Issue
Block a user