mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(core): Reduce boilterplate code in between tests 🧹, and fix the tests in node.js 20 (no-changelog) (#6654)
refactor(core): Reduce boilterplate code in between tests also cleaned up some imports, and fixed the tests in node.js 20
This commit is contained in:
committed by
GitHub
parent
3e07ffa73e
commit
b895ba438a
@@ -16,7 +16,7 @@ import type { InstalledNodes } from '@db/entities/InstalledNodes';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { Push } from '@/push';
|
||||
import { COMMUNITY_PACKAGE_VERSION } from './shared/constants';
|
||||
import * as utils from './shared/utils';
|
||||
import * as utils from './shared/utils/';
|
||||
import * as testDb from './shared/testDb';
|
||||
|
||||
const mockLoadNodesAndCredentials = utils.mockInstance(LoadNodesAndCredentials);
|
||||
@@ -44,17 +44,15 @@ jest.mock('@/CommunityNodes/packageModel', () => {
|
||||
|
||||
const mockedEmptyPackage = mocked(utils.emptyPackage);
|
||||
|
||||
const testServer = utils.setupTestServer({ endpointGroups: ['nodes'] });
|
||||
|
||||
let ownerShell: User;
|
||||
let authOwnerShellAgent: SuperAgentTest;
|
||||
|
||||
beforeAll(async () => {
|
||||
const app = await utils.initTestServer({ endpointGroups: ['nodes'] });
|
||||
|
||||
const globalOwnerRole = await testDb.getGlobalOwnerRole();
|
||||
ownerShell = await testDb.createUserShell(globalOwnerRole);
|
||||
authOwnerShellAgent = utils.createAuthAgent(app)(ownerShell);
|
||||
|
||||
await utils.initConfigFile();
|
||||
authOwnerShellAgent = testServer.authAgentFor(ownerShell);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -64,10 +62,6 @@ beforeEach(async () => {
|
||||
mocked(findInstalledPackage).mockReset();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await testDb.terminate();
|
||||
});
|
||||
|
||||
describe('GET /nodes', () => {
|
||||
test('should respond 200 if no nodes are installed', async () => {
|
||||
const {
|
||||
|
||||
Reference in New Issue
Block a user