mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
chore(core): Add test case for getStatus pull case (no-changelog) (#15598)
This commit is contained in:
@@ -11,6 +11,7 @@ import { InstanceSettings } from 'n8n-core';
|
|||||||
|
|
||||||
import { SourceControlPreferencesService } from '@/environments.ee/source-control/source-control-preferences.service.ee';
|
import { SourceControlPreferencesService } from '@/environments.ee/source-control/source-control-preferences.service.ee';
|
||||||
import { SourceControlService } from '@/environments.ee/source-control/source-control.service.ee';
|
import { SourceControlService } from '@/environments.ee/source-control/source-control.service.ee';
|
||||||
|
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||||
|
|
||||||
import type { SourceControlImportService } from '../source-control-import.service.ee';
|
import type { SourceControlImportService } from '../source-control-import.service.ee';
|
||||||
import type { ExportableCredential } from '../types/exportable-credential';
|
import type { ExportableCredential } from '../types/exportable-credential';
|
||||||
@@ -243,5 +244,20 @@ describe('SourceControlService', () => {
|
|||||||
expect(pullResult.find((i) => i.type === 'folders')).toHaveProperty('conflict', true);
|
expect(pullResult.find((i) => i.type === 'folders')).toHaveProperty('conflict', true);
|
||||||
expect(pushResult.find((i) => i.type === 'folders')).toHaveProperty('conflict', false);
|
expect(pushResult.find((i) => i.type === 'folders')).toHaveProperty('conflict', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should throw `ForbiddenError` if direction is pull and user is not allowed to globally pull', async () => {
|
||||||
|
// ARRANGE
|
||||||
|
const user = mock<User>();
|
||||||
|
user.role = 'global:member';
|
||||||
|
|
||||||
|
// ACT
|
||||||
|
await expect(
|
||||||
|
sourceControlService.getStatus(user, {
|
||||||
|
direction: 'pull',
|
||||||
|
verbose: false,
|
||||||
|
preferLocalVersion: false,
|
||||||
|
}),
|
||||||
|
).rejects.toThrowError(ForbiddenError);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user