chore(core): Add test case for getStatus pull case (no-changelog) (#15598)

This commit is contained in:
Andreas Fitzek
2025-05-22 16:30:27 +02:00
committed by GitHub
parent e23ffccca8
commit b1da30f493

View File

@@ -11,6 +11,7 @@ import { InstanceSettings } from 'n8n-core';
import { SourceControlPreferencesService } from '@/environments.ee/source-control/source-control-preferences.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 { ExportableCredential } from '../types/exportable-credential';
@@ -243,5 +244,20 @@ describe('SourceControlService', () => {
expect(pullResult.find((i) => i.type === 'folders')).toHaveProperty('conflict', true);
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);
});
});
});