ci(core): Reduce memory usage in tests (part-2) (no-changelog) (#7671)

This also gets rid of `Db.collection`, which was another source of
circular dependencies.
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-11-10 15:04:26 +01:00
committed by GitHub
parent 37dd658dc5
commit 000e76e3b4
174 changed files with 892 additions and 808 deletions

View File

@@ -18,6 +18,7 @@ import {
import { constants as fsConstants, accessSync } from 'fs';
import type { SourceControlledFile } from '@/environments/sourceControl/types/sourceControlledFile';
import type { SourceControlPreferences } from '@/environments/sourceControl/types/sourceControlPreferences';
import { mockInstance } from '../shared/mocking';
const pushResult: SourceControlledFile[] = [
{
@@ -149,8 +150,11 @@ const pullResult: SourceControlledFile[] = [
},
];
const license = mockInstance(License);
beforeAll(async () => {
Container.get(License).isSourceControlLicensed = () => true;
jest.resetAllMocks();
license.isSourceControlLicensed.mockReturnValue(true);
Container.get(SourceControlPreferencesService).getPreferences = () => ({
branchName: 'main',
connected: true,
@@ -205,10 +209,6 @@ describe('Source Control', () => {
expect(accessSync(gitFolder, fsConstants.F_OK)).toBeUndefined();
});
it('should check if source control is licensed', async () => {
expect(Container.get(License).isSourceControlLicensed()).toBe(true);
});
it('should get repo type from url', async () => {
expect(getRepoType('git@github.com:n8ntest/n8n_testrepo.git')).toBe('github');
expect(getRepoType('git@gitlab.com:n8ntest/n8n_testrepo.git')).toBe('gitlab');