chore: apply ESLint auto-fix across entire backend
Build and Push Multi-Platform Images / build-and-push (push) Successful in 41s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 41s
Reformats code style (line breaks, indentation, type annotations) without changing logic. Also includes minor feature additions bundled in the same lint run (stats service, user-settings groups, agrarmonitor polling improvements). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,12 +6,39 @@ import { PostprocessingAction } from '../database/entities/postprocessing-action
|
||||
import { PaperlessService } from '../paperless/paperless.service';
|
||||
|
||||
const mockRules: Partial<Postprocessing>[] = [
|
||||
{ Id: 1, Name: 'Rule1', DocumentTypeId: 5, CorrespondentId: null, OwnerId: null, TagId: null, Order: 1, IsActive: true, NoFurther: false },
|
||||
{ Id: 2, Name: 'StopRule', DocumentTypeId: null, CorrespondentId: null, OwnerId: null, TagId: null, Order: 2, IsActive: true, NoFurther: true },
|
||||
{
|
||||
Id: 1,
|
||||
Name: 'Rule1',
|
||||
DocumentTypeId: 5,
|
||||
CorrespondentId: null,
|
||||
OwnerId: null,
|
||||
TagId: null,
|
||||
Order: 1,
|
||||
IsActive: true,
|
||||
NoFurther: false,
|
||||
},
|
||||
{
|
||||
Id: 2,
|
||||
Name: 'StopRule',
|
||||
DocumentTypeId: null,
|
||||
CorrespondentId: null,
|
||||
OwnerId: null,
|
||||
TagId: null,
|
||||
Order: 2,
|
||||
IsActive: true,
|
||||
NoFurther: true,
|
||||
},
|
||||
];
|
||||
|
||||
const mockActions: Partial<PostprocessingAction>[] = [
|
||||
{ Id: 1, PostprocessingId: 1, ActionType: 2, Content: '99', Order: 1, IsActive: true },
|
||||
{
|
||||
Id: 1,
|
||||
PostprocessingId: 1,
|
||||
ActionType: 2,
|
||||
Content: '99',
|
||||
Order: 1,
|
||||
IsActive: true,
|
||||
},
|
||||
];
|
||||
|
||||
describe('PostprocessingService', () => {
|
||||
@@ -29,7 +56,10 @@ describe('PostprocessingService', () => {
|
||||
providers: [
|
||||
PostprocessingService,
|
||||
{ provide: getRepositoryToken(Postprocessing), useValue: ppRepo },
|
||||
{ provide: getRepositoryToken(PostprocessingAction), useValue: ppActionRepo },
|
||||
{
|
||||
provide: getRepositoryToken(PostprocessingAction),
|
||||
useValue: ppActionRepo,
|
||||
},
|
||||
{ provide: PaperlessService, useValue: paperlessService },
|
||||
],
|
||||
}).compile();
|
||||
@@ -58,7 +88,9 @@ describe('PostprocessingService', () => {
|
||||
where: { PostprocessingId: 1, IsActive: true },
|
||||
order: { Order: 'ASC' },
|
||||
});
|
||||
expect(paperlessService.updateDocument).toHaveBeenCalledWith(100, { tags: [99] });
|
||||
expect(paperlessService.updateDocument).toHaveBeenCalledWith(100, {
|
||||
tags: [99],
|
||||
});
|
||||
});
|
||||
|
||||
it('evaluate stops at NoFurther rule', async () => {
|
||||
@@ -72,7 +104,11 @@ describe('PostprocessingService', () => {
|
||||
it('evaluate skips non-matching rules', async () => {
|
||||
// documentTypeId=999 doesn't match Rule1 (requires 5) but matches Rule2 (no filter)
|
||||
ppActionRepo.find.mockResolvedValue([]);
|
||||
await service.evaluate({ documentId: 100, documentTypeId: 999, tagIds: [] });
|
||||
await service.evaluate({
|
||||
documentId: 100,
|
||||
documentTypeId: 999,
|
||||
tagIds: [],
|
||||
});
|
||||
|
||||
// Rule1 skipped, Rule2 matched → only 1 action lookup
|
||||
expect(ppActionRepo.find).toHaveBeenCalledTimes(1);
|
||||
|
||||
Reference in New Issue
Block a user