mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { mock } from 'jest-mock-extended';
|
|
import { InstanceSettings } from 'n8n-core';
|
|
import { Container } from 'typedi';
|
|
|
|
import { SourceControlPreferencesService } from '@/environments/source-control/source-control-preferences.service.ee';
|
|
import { SourceControlService } from '@/environments/source-control/source-control.service.ee';
|
|
|
|
describe('SourceControlService', () => {
|
|
const preferencesService = new SourceControlPreferencesService(
|
|
Container.get(InstanceSettings),
|
|
mock(),
|
|
mock(),
|
|
);
|
|
const sourceControlService = new SourceControlService(
|
|
mock(),
|
|
mock(),
|
|
preferencesService,
|
|
mock(),
|
|
mock(),
|
|
mock(),
|
|
mock(),
|
|
);
|
|
|
|
describe('pushWorkfolder', () => {
|
|
it('should throw an error if a file is given that is not in the workfolder', async () => {
|
|
jest.spyOn(sourceControlService, 'sanityCheck').mockResolvedValue(undefined);
|
|
|
|
await expect(
|
|
sourceControlService.pushWorkfolder({
|
|
fileNames: [
|
|
{
|
|
file: '/etc/passwd',
|
|
id: 'test',
|
|
name: 'secret-file',
|
|
type: 'file',
|
|
status: 'modified',
|
|
location: 'local',
|
|
conflict: false,
|
|
updatedAt: new Date().toISOString(),
|
|
pushed: false,
|
|
},
|
|
],
|
|
}),
|
|
).rejects.toThrow('File path /etc/passwd is invalid');
|
|
});
|
|
});
|
|
});
|