Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
af-egr committed Jan 28, 2025
1 parent f4b41e4 commit 8f2e3f6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import { SignContractDto } from '../../dto/sign-contract.dto';
import { ProposalStatus } from '../../enums/proposal-status.enum';
import { ProposalDocument } from '../../schema/proposal.schema';
import { addContractSign } from '../../utils/add-contract-sign.util';
import { addDizApproval, addUacApproval, addUacApprovalWithCondition } from '../../utils/add-location-vote.util';
import {
addDizApproval,
addUacApprovalWithCondition,
addDizConditionReview,
addDizApprovalWithCondition,
addDizConditionApproval,
} from '../../utils/add-location-vote.util';
import {
addHistoryItemForContractSign,
addHistoryItemForDizApproval,
Expand Down Expand Up @@ -49,7 +55,7 @@ jest.mock('../../utils/add-location-vote.util', () => ({
addDizApproval: jest.fn(),
addUacApproval: jest.fn(),
addUacApprovalWithCondition: jest.fn(),
addUacConditionReview: jest.fn(),
addDizConditionReview: jest.fn(),
}));
jest.mock('../../utils/revert-location-vote.util', () => ({
revertLocationVote: jest.fn(),
Expand Down Expand Up @@ -233,13 +239,20 @@ describe('ProposalContractingService', () => {
expect(addUpload).toHaveBeenCalledWith(proposalDocument, expect.objectContaining({ blobName: 'blobName' }));
expect(addUacApprovalWithCondition).toHaveBeenCalledWith(
proposalDocument,
request.user.miiLocation,
expect.objectContaining({ blobName: 'blobName' }),
request.user,
vote,
expect.objectContaining({ blobName: 'blobName' }),
undefined,
);
expect(storageService.uploadFile).toHaveBeenCalledWith('blobName', file, request.user);
} else {
expect(addUacApproval).toHaveBeenCalledWith(proposalDocument, request.user, vote);
expect(addUacApprovalWithCondition).toHaveBeenCalledWith(
proposalDocument,
request.user,
vote,
undefined,
undefined,
);
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,11 @@ describe('ProposalCrudService', () => {
['reports.content']: 1,
owner: 1,
conditionalApprovals: 1,
locationConditionDraft: 1,
openDizChecks: 1,
dizApprovedLocations: 1,
uacApprovedLocations: 1,
openDizConditionChecks: 1,
signedContracts: 1,
requestedButExcludedLocations: 1,
};
Expand All @@ -277,6 +279,8 @@ describe('ProposalCrudService', () => {
owner: 1,
conditionalApprovals: 1,
dizApprovedLocations: 1,
locationConditionDraft: 1,
openDizConditionChecks: 1,
uacApprovedLocations: 1,
signedContracts: 1,
requestedButExcludedLocations: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const proposalContent = {
requestedButExcludedLocations: [],
openDizChecks: [MiiLocation.Charité, MiiLocation.KC],
dizApprovedLocations: [MiiLocation.KUM, MiiLocation.MHH],
openDizConditionChecks: [MiiLocation.CTK],
signedContracts: [MiiLocation.MRI, MiiLocation.UKA],
uacApprovedLocations: [MiiLocation.UKAU, MiiLocation.UKB],
uacApprovals: [{}] as UacApproval[],
Expand Down
2 changes: 1 addition & 1 deletion src/modules/proposal/services/status-change.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class StatusChangeService {

proposalAfterChanges.statusChangeToLocationCheckAt = new Date();

//scheduleTypesToRemove.push(ScheduleType.ReminderFdpgCheck);
scheduleTypesToRemove.push(ScheduleType.ReminderFdpgCheck);
scheduleTypesToAdd.push(
ScheduleType.ReminderLocationCheck1,
ScheduleType.ReminderLocationCheck2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const proposalContent = {
openDizChecks: [MiiLocation.UKL],
dizApprovedLocations: [MiiLocation.UKM],
uacApprovedLocations: [MiiLocation.UKMR],
openDizConditionChecks: [MiiLocation.Charité],
signedContracts: [MiiLocation.UKR],
requestedButExcludedLocations: [MiiLocation.UKD],
conditionalApprovals: [conditionalApproval],
Expand Down Expand Up @@ -70,6 +71,7 @@ describe('location-flow.util', () => {
expect(proposal.openDizChecks.length).toEqual(0);
expect(proposal.dizApprovedLocations.length).toEqual(1);
expect(proposal.uacApprovedLocations.length).toEqual(1);
expect(proposal.openDizConditionChecks.length).toEqual(1);
expect(proposal.signedContracts.length).toEqual(1);
expect(proposal.requestedButExcludedLocations.length).toEqual(1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ describe('revertLocationVoteUtil', () => {
isDizCheck: false,
dizApproved: false,
uacApproved: false,
openDizConditionChecks: false,
isConditionalApproval: false,
conditionalApprovalAccepted: false,
conditionalApprovalDeclined: false,
Expand Down

0 comments on commit 8f2e3f6

Please sign in to comment.