mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor: Remove pre-setup prompt on owner setup (#6495)
This commit is contained in:
committed by
कारतोफ्फेलस्क्रिप्ट™
parent
0287d5becd
commit
abe7f71627
@@ -4,12 +4,7 @@ import type { ILogger } from 'n8n-workflow';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import type { IInternalHooksClass } from '@/Interfaces';
|
||||
import type { User } from '@db/entities/User';
|
||||
import type {
|
||||
CredentialsRepository,
|
||||
SettingsRepository,
|
||||
UserRepository,
|
||||
WorkflowRepository,
|
||||
} from '@db/repositories';
|
||||
import type { SettingsRepository, UserRepository } from '@db/repositories';
|
||||
import type { Config } from '@/config';
|
||||
import { BadRequestError } from '@/ResponseHelper';
|
||||
import type { OwnerRequest } from '@/requests';
|
||||
@@ -23,8 +18,6 @@ describe('OwnerController', () => {
|
||||
const internalHooks = mock<IInternalHooksClass>();
|
||||
const userRepository = mock<UserRepository>();
|
||||
const settingsRepository = mock<SettingsRepository>();
|
||||
const credentialsRepository = mock<CredentialsRepository>();
|
||||
const workflowsRepository = mock<WorkflowRepository>();
|
||||
const controller = new OwnerController({
|
||||
config,
|
||||
logger,
|
||||
@@ -32,29 +25,9 @@ describe('OwnerController', () => {
|
||||
repositories: {
|
||||
User: userRepository,
|
||||
Settings: settingsRepository,
|
||||
Credentials: credentialsRepository,
|
||||
Workflow: workflowsRepository,
|
||||
},
|
||||
});
|
||||
|
||||
describe('preSetup', () => {
|
||||
it('should throw a BadRequestError if the instance owner is already setup', async () => {
|
||||
config.getEnv.calledWith('userManagement.isInstanceOwnerSetUp').mockReturnValue(true);
|
||||
await expect(controller.preSetup()).rejects.toThrowError(
|
||||
new BadRequestError('Instance owner already setup'),
|
||||
);
|
||||
});
|
||||
|
||||
it('should a return credential and workflow count', async () => {
|
||||
config.getEnv.calledWith('userManagement.isInstanceOwnerSetUp').mockReturnValue(false);
|
||||
credentialsRepository.countBy.mockResolvedValue(7);
|
||||
workflowsRepository.countBy.mockResolvedValue(31);
|
||||
const { credentials, workflows } = await controller.preSetup();
|
||||
expect(credentials).toBe(7);
|
||||
expect(workflows).toBe(31);
|
||||
});
|
||||
});
|
||||
|
||||
describe('setupOwner', () => {
|
||||
it('should throw a BadRequestError if the instance owner is already setup', async () => {
|
||||
config.getEnv.calledWith('userManagement.isInstanceOwnerSetUp').mockReturnValue(true);
|
||||
|
||||
Reference in New Issue
Block a user