mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 03:42:16 +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
29
packages/cli/test/integration/shared/utils/communityNodes.ts
Normal file
29
packages/cli/test/integration/shared/utils/communityNodes.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { NODE_PACKAGE_PREFIX } from '@/constants';
|
||||
import { InstalledPackages } from '@db/entities/InstalledPackages';
|
||||
|
||||
import { randomName } from '../random';
|
||||
import { COMMUNITY_NODE_VERSION, COMMUNITY_PACKAGE_VERSION } from '../constants';
|
||||
import type { InstalledNodePayload, InstalledPackagePayload } from '../types';
|
||||
|
||||
export function installedPackagePayload(): InstalledPackagePayload {
|
||||
return {
|
||||
packageName: NODE_PACKAGE_PREFIX + randomName(),
|
||||
installedVersion: COMMUNITY_PACKAGE_VERSION.CURRENT,
|
||||
};
|
||||
}
|
||||
|
||||
export function installedNodePayload(packageName: string): InstalledNodePayload {
|
||||
const nodeName = randomName();
|
||||
return {
|
||||
name: nodeName,
|
||||
type: nodeName,
|
||||
latestVersion: COMMUNITY_NODE_VERSION.CURRENT,
|
||||
package: packageName,
|
||||
};
|
||||
}
|
||||
|
||||
export const emptyPackage = async () => {
|
||||
const installedPackage = new InstalledPackages();
|
||||
installedPackage.installedNodes = [];
|
||||
return installedPackage;
|
||||
};
|
||||
Reference in New Issue
Block a user