prettier fix

This commit is contained in:
Danel Kungla
2025-09-19 17:22:36 +03:00
parent efa94b3322
commit 0c2cfe6d18
509 changed files with 17988 additions and 9920 deletions

View File

@@ -1,8 +1,16 @@
import { AnalysisResponseElement } from "~/lib/types/analysis-response-element";
import { canCreateAnalysisResponseElement, getAnalysisResponseElementsForGroup } from "./medipostPrivateMessage.service";
import { ResponseUuring } from "@/packages/shared/src/types/medipost-analysis";
import { ResponseUuring } from '@/packages/shared/src/types/medipost-analysis';
type TestExistingElement = Pick<AnalysisResponseElement, 'analysis_element_original_id' | 'status' | 'response_value'>;
import { AnalysisResponseElement } from '~/lib/types/analysis-response-element';
import {
canCreateAnalysisResponseElement,
getAnalysisResponseElementsForGroup,
} from './medipostPrivateMessage.service';
type TestExistingElement = Pick<
AnalysisResponseElement,
'analysis_element_original_id' | 'status' | 'response_value'
>;
describe('medipostPrivateMessage.service', () => {
describe('canCreateAnalysisResponseElement', () => {
@@ -16,11 +24,20 @@ describe('medipostPrivateMessage.service', () => {
} as const;
const responseValue = 1;
const log = jest.fn();
expect(await canCreateAnalysisResponseElement({ existingElements, groupUuring, responseValue, log })).toBe(true);
expect(
await canCreateAnalysisResponseElement({
existingElements,
groupUuring,
responseValue,
log,
}),
).toBe(true);
});
it('should return false if the analysis response element exists and the status is higher', async () => {
const existingElements = [{ analysis_element_original_id: '1', status: '2', response_value: 1 }] as TestExistingElement[];
const existingElements = [
{ analysis_element_original_id: '1', status: '2', response_value: 1 },
] as TestExistingElement[];
const groupUuring = {
UuringuElement: {
UuringOlek: 1,
@@ -29,7 +46,14 @@ describe('medipostPrivateMessage.service', () => {
} as const;
const responseValue = 1;
const log = jest.fn();
expect(await canCreateAnalysisResponseElement({ existingElements, groupUuring, responseValue, log })).toBe(false);
expect(
await canCreateAnalysisResponseElement({
existingElements,
groupUuring,
responseValue,
log,
}),
).toBe(false);
});
});
@@ -49,8 +73,14 @@ describe('medipostPrivateMessage.service', () => {
} as const;
const existingElements = [] as TestExistingElement[];
const log = jest.fn();
expect(await getAnalysisResponseElementsForGroup({ analysisGroup, existingElements, log }))
.toEqual([{
expect(
await getAnalysisResponseElementsForGroup({
analysisGroup,
existingElements,
log,
}),
).toEqual([
{
analysis_element_original_id: '1',
analysis_name: undefined,
comment: null,
@@ -68,7 +98,8 @@ describe('medipostPrivateMessage.service', () => {
UuringuVastus: [{ VastuseVaartus: '1' }],
},
status: '1',
}]);
},
]);
});
it('should return no new element if element already exists in higher status', async () => {
@@ -84,10 +115,17 @@ describe('medipostPrivateMessage.service', () => {
},
] as unknown as ResponseUuring[],
} as const;
const existingElements = [{ analysis_element_original_id: '1', status: '2', response_value: 1 }] as TestExistingElement[];
const existingElements = [
{ analysis_element_original_id: '1', status: '2', response_value: 1 },
] as TestExistingElement[];
const log = jest.fn();
expect(await getAnalysisResponseElementsForGroup({ analysisGroup, existingElements, log }))
.toEqual([]);
expect(
await getAnalysisResponseElementsForGroup({
analysisGroup,
existingElements,
log,
}),
).toEqual([]);
});
it('should return no new element if element already exists with response value', async () => {
@@ -103,10 +141,17 @@ describe('medipostPrivateMessage.service', () => {
},
] as unknown as ResponseUuring[],
} as const;
const existingElements = [{ analysis_element_original_id: '1', status: '1', response_value: 1 }] as TestExistingElement[];
const existingElements = [
{ analysis_element_original_id: '1', status: '1', response_value: 1 },
] as TestExistingElement[];
const log = jest.fn();
expect(await getAnalysisResponseElementsForGroup({ analysisGroup, existingElements, log }))
.toEqual([]);
expect(
await getAnalysisResponseElementsForGroup({
analysisGroup,
existingElements,
log,
}),
).toEqual([]);
});
});
});