@seniorsistemas/hcm-clocking-event-rule-nodejs 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/copilot-instructions.md +11 -0
- package/.github/workflows/release.yaml +10 -0
- package/.gitlab-ci.yml +68 -0
- package/CHANGELOG.md +274 -0
- package/README.doc.md +658 -0
- package/README.md +117 -0
- package/assets/favicon.ico +0 -0
- package/catalog-info.yaml +19 -0
- package/jest.config.js +17 -0
- package/package.json +48 -0
- package/prompt.md +15 -0
- package/run_build_win.bat +1 -0
- package/run_link.bat +3 -0
- package/run_test.bat +1 -0
- package/sonar-project.properties +21 -0
- package/src/data/changes/changes.ts +92 -0
- package/src/data/context/context.ts +251 -0
- package/src/data/context/contextReference.ts +376 -0
- package/src/data/contract/contract.ts +272 -0
- package/src/data/dataset/database.ts +130 -0
- package/src/data/dataset/dataset.ts +275 -0
- package/src/data/definition/timeEvaluationSituationDefinitionHistory.ts +1425 -0
- package/src/data/employee/employee.ts +434 -0
- package/src/data/foundation/companyBranch.ts +66 -0
- package/src/data/foundation/costCenter.ts +47 -0
- package/src/data/foundation/employer.ts +35 -0
- package/src/data/foundation/employmentRelationship.ts +63 -0
- package/src/data/foundation/holiday.ts +84 -0
- package/src/data/foundation/holidayGroup.ts +47 -0
- package/src/data/foundation/jobPosition.ts +73 -0
- package/src/data/foundation/person.ts +35 -0
- package/src/data/foundation/situation.ts +301 -0
- package/src/data/foundation/syndicate.ts +244 -0
- package/src/data/foundation/workschedule.ts +688 -0
- package/src/data/foundation/workshift.ts +647 -0
- package/src/data/foundation/workshiftBase.ts +113 -0
- package/src/data/histories/companyBranchHistory.ts +128 -0
- package/src/data/histories/costCenterHistory.ts +114 -0
- package/src/data/histories/employmentRelationshipHistory.ts +116 -0
- package/src/data/histories/histories.ts +419 -0
- package/src/data/histories/jobPositionHistory.ts +117 -0
- package/src/data/histories/leaveHistory.ts +227 -0
- package/src/data/histories/timeEvaluationHistory.ts +191 -0
- package/src/data/histories/workshiftHistory.ts +66 -0
- package/src/data/hourBank/hourBank.ts +43 -0
- package/src/data/hourBank/hourBankAccount.ts +77 -0
- package/src/data/log/log.ts +38 -0
- package/src/data/schedules/bridge.ts +84 -0
- package/src/data/schedules/compensation.ts +332 -0
- package/src/data/schedules/overtimeAuthorization.ts +174 -0
- package/src/data/schedules/readiness.ts +150 -0
- package/src/data/schedules/schedules.ts +398 -0
- package/src/data/schedules/workscheduleChange.ts +91 -0
- package/src/data/schedules/workshiftChange.ts +76 -0
- package/src/data/timeEvaluation/adjustmentReason.ts +46 -0
- package/src/data/timeEvaluation/clockingEvent.ts +198 -0
- package/src/data/timeEvaluation/estimatedHours.ts +245 -0
- package/src/data/timeEvaluation/interval.ts +568 -0
- package/src/data/timeEvaluation/separatedHours.ts +134 -0
- package/src/data/timeEvaluation/timeEvaluation.ts +1540 -0
- package/src/data/timeEvaluation/timeEvaluationSituation.ts +154 -0
- package/src/data/user/user.ts +44 -0
- package/src/index.ts +60 -0
- package/src/test/builder/bridgeBuilder.builder.ts +28 -0
- package/src/test/builder/clockingEvent.builder.ts +49 -0
- package/src/test/builder/companyBranchHistoryBuilder.ts +29 -0
- package/src/test/builder/compensation.builder.ts +84 -0
- package/src/test/builder/contextReference.builder.ts +69 -0
- package/src/test/builder/costCenterHistoryBuilder.ts +29 -0
- package/src/test/builder/database.builder.ts +21 -0
- package/src/test/builder/datasetBuilder.ts +111 -0
- package/src/test/builder/dateIntervalBuilder.ts +25 -0
- package/src/test/builder/employee.builder.ts +91 -0
- package/src/test/builder/employmentRelationshipBuilder.ts +35 -0
- package/src/test/builder/employmentRelationshipHistoryBuilder.ts +29 -0
- package/src/test/builder/historiesBuilder.ts +56 -0
- package/src/test/builder/holiday.builder.ts +44 -0
- package/src/test/builder/hourBankAccountBuilder.ts +77 -0
- package/src/test/builder/hourBankBuilder.ts +32 -0
- package/src/test/builder/interval.builder.ts +113 -0
- package/src/test/builder/jobPositionHistoryBuilder.ts +29 -0
- package/src/test/builder/overtimeAuthorization.builder.ts +42 -0
- package/src/test/builder/readinessBuilder.builder.ts +57 -0
- package/src/test/builder/schedules.builder.ts +126 -0
- package/src/test/builder/situation.builder.ts +59 -0
- package/src/test/builder/syndicate.builder.ts +96 -0
- package/src/test/builder/syndicateHistoryBuilder.ts +33 -0
- package/src/test/builder/timeEvaluation.builder.ts +138 -0
- package/src/test/builder/timeEvaluationHistory.builder.ts +49 -0
- package/src/test/builder/timeEvaluationSituation.builder.ts +34 -0
- package/src/test/builder/workschedule.builder.ts +96 -0
- package/src/test/builder/workshift.builder.ts +179 -0
- package/src/test/builder/workshiftBuilder.ts +55 -0
- package/src/test/data/clockingEvent.spec.ts +56 -0
- package/src/test/data/context.spec.ts +176 -0
- package/src/test/data/currentUser.spec.ts +11 -0
- package/src/test/data/dataset.spec.ts +144 -0
- package/src/test/data/employee/employee.spec.ts +20 -0
- package/src/test/data/employmentRelationship/employmentRelationship.spec.ts +48 -0
- package/src/test/data/estimatedHours/estimatedHours.spec.ts +96 -0
- package/src/test/data/histories/costCenterHistory.spec.ts +32 -0
- package/src/test/data/histories/histories.spec.ts +306 -0
- package/src/test/data/holyday.spec.ts +89 -0
- package/src/test/data/hourBank/hourBank.spec.ts +48 -0
- package/src/test/data/hourBank/hourBankAccount.spec.ts +32 -0
- package/src/test/data/schedules/bridge.spec.ts +13 -0
- package/src/test/data/schedules/compesation.spect.ts +89 -0
- package/src/test/data/schedules/overtimeAuthorization.spec.ts +52 -0
- package/src/test/data/schedules/readiness.spec.ts +64 -0
- package/src/test/data/schedules/schedules.spec.ts +134 -0
- package/src/test/data/schedules/workscheduleChange.spec.ts +21 -0
- package/src/test/data/syndicate/syndicate.spec.ts +51 -0
- package/src/test/data/timeEvaluation.spec.ts +1057 -0
- package/src/test/data/timeEvaluationDefinition.spec.ts +144 -0
- package/src/test/data/workschedule/workschedule.spec.ts +194 -0
- package/src/test/data/workshift/workshift.spec.ts +79 -0
- package/src/test/utils/date.utils.spec.ts +198 -0
- package/src/test/utils/dateIntervalUtils.spec.ts +210 -0
- package/src/test/utils/object.utils.spec.ts +83 -0
- package/src/utils/dateIntervalUtils.ts +284 -0
- package/src/utils/dateUtils.ts +456 -0
- package/src/utils/decompressGzipLambda.ts +15 -0
- package/src/utils/object.utils.ts +156 -0
- package/trivy/vulnerabilities_scan.json +1160 -0
- package/tsconfig.json +32 -0
- package/tsconfig.spec.json +21 -0
- package/tslint.json +92 -0
- package/typedoc.json +22 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EmploymentRelationshipBuilder } from "../../builder/employmentRelationshipBuilder";
|
|
2
|
+
import { ContractType } from '../../../data/contract/contract';
|
|
3
|
+
|
|
4
|
+
describe("EmploymentRelationship", () => {
|
|
5
|
+
it("deve criar uma instância com valores padrão", () => {
|
|
6
|
+
// Arrange & Act
|
|
7
|
+
const relationshipInstance = EmploymentRelationshipBuilder.builder().build();
|
|
8
|
+
|
|
9
|
+
// Assert
|
|
10
|
+
expect(relationshipInstance).toBeDefined();
|
|
11
|
+
expect(relationshipInstance.id).toBe("123");
|
|
12
|
+
expect(relationshipInstance.code).toBe("1");
|
|
13
|
+
expect(relationshipInstance.contractType).toBe(ContractType.EMPLOYEE);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("deve criar uma instância com ID personalizado", () => {
|
|
17
|
+
// Arrange & Act
|
|
18
|
+
const customId = "123";
|
|
19
|
+
const relationshipInstance = EmploymentRelationshipBuilder.builder()
|
|
20
|
+
.withId(customId)
|
|
21
|
+
.build();
|
|
22
|
+
|
|
23
|
+
// Assert
|
|
24
|
+
expect(relationshipInstance.id).toBe(customId);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("deve criar uma instância com código personalizado", () => {
|
|
28
|
+
// Arrange & Act
|
|
29
|
+
const customCode = "1";
|
|
30
|
+
const relationshipInstance = EmploymentRelationshipBuilder.builder()
|
|
31
|
+
.withCode(customCode)
|
|
32
|
+
.build();
|
|
33
|
+
|
|
34
|
+
// Assert
|
|
35
|
+
expect(relationshipInstance.code).toBe(customCode);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("deve criar uma instância com tipo de contrato personalizado", () => {
|
|
39
|
+
// Arrange & Act
|
|
40
|
+
const customContractType = ContractType.EMPLOYEE;
|
|
41
|
+
const relationshipInstance = EmploymentRelationshipBuilder.builder()
|
|
42
|
+
.withContractType(customContractType)
|
|
43
|
+
.build();
|
|
44
|
+
|
|
45
|
+
// Assert
|
|
46
|
+
expect(relationshipInstance.contractType).toBe(customContractType);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { EstimatedHours, EstimatedHoursParams } from "../../../data/timeEvaluation/estimatedHours";
|
|
2
|
+
import { SeparatedHours } from "../../../data/timeEvaluation/separatedHours";
|
|
3
|
+
|
|
4
|
+
describe("EstimatedHours", () => {
|
|
5
|
+
let estimatedHours: EstimatedHours;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
const params: EstimatedHoursParams = {
|
|
9
|
+
meal: [
|
|
10
|
+
{ dailyHours: 90, nightlyHours: 0 },
|
|
11
|
+
{ dailyHours: 30, nightlyHours: 10 }
|
|
12
|
+
],
|
|
13
|
+
snack: [
|
|
14
|
+
{ dailyHours: 15, nightlyHours: 5 }
|
|
15
|
+
],
|
|
16
|
+
work: [
|
|
17
|
+
{ dailyHours: 120, nightlyHours: 30 },
|
|
18
|
+
{ dailyHours: 60, nightlyHours: 0 }
|
|
19
|
+
]
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
estimatedHours = new EstimatedHours(params);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("Deve inicializar corretamente com os parâmetros fornecidos", () => {
|
|
26
|
+
expect(estimatedHours.meal.length).toBe(2);
|
|
27
|
+
expect(estimatedHours.snack.length).toBe(1);
|
|
28
|
+
expect(estimatedHours.work.length).toBe(2);
|
|
29
|
+
|
|
30
|
+
expect(estimatedHours.meal[0]).toBeInstanceOf(SeparatedHours);
|
|
31
|
+
expect(estimatedHours.snack[0]).toBeInstanceOf(SeparatedHours);
|
|
32
|
+
expect(estimatedHours.work[0]).toBeInstanceOf(SeparatedHours);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("Deve retornar a soma de todas as horas de trabalho quando part não for informado", () => {
|
|
36
|
+
const totalWorkHours = estimatedHours.getWorkHours();
|
|
37
|
+
expect(totalWorkHours.dailyHours).toBe(180); // 120 + 60
|
|
38
|
+
expect(totalWorkHours.nightlyHours).toBe(30); // 30 + 0
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("Deve retornar as horas de trabalho de uma parte específica", () => {
|
|
42
|
+
const part1 = estimatedHours.getWorkHours(1);
|
|
43
|
+
expect(part1.dailyHours).toBe(120);
|
|
44
|
+
expect(part1.nightlyHours).toBe(30);
|
|
45
|
+
|
|
46
|
+
const part2 = estimatedHours.getWorkHours(2);
|
|
47
|
+
expect(part2.dailyHours).toBe(60);
|
|
48
|
+
expect(part2.nightlyHours).toBe(0);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("Deve retornar um objeto vazio se o índice for inválido para horas de trabalho", () => {
|
|
52
|
+
const invalidPart = estimatedHours.getWorkHours(3); // Índice inválido
|
|
53
|
+
expect(invalidPart.dailyHours).toBe(0);
|
|
54
|
+
expect(invalidPart.nightlyHours).toBe(0);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("Deve retornar a soma de todas as horas de refeição quando part não for informado", () => {
|
|
58
|
+
const totalMealHours = estimatedHours.getMealHours();
|
|
59
|
+
expect(totalMealHours.dailyHours).toBe(120); // 90 + 30
|
|
60
|
+
expect(totalMealHours.nightlyHours).toBe(10); // 0 + 10
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("Deve retornar as horas de refeição de uma parte específica", () => {
|
|
64
|
+
const part1 = estimatedHours.getMealHours(1);
|
|
65
|
+
expect(part1.dailyHours).toBe(90);
|
|
66
|
+
expect(part1.nightlyHours).toBe(0);
|
|
67
|
+
|
|
68
|
+
const part2 = estimatedHours.getMealHours(2);
|
|
69
|
+
expect(part2.dailyHours).toBe(30);
|
|
70
|
+
expect(part2.nightlyHours).toBe(10);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("Deve retornar um objeto vazio se o índice for inválido para horas de refeição", () => {
|
|
74
|
+
const invalidPart = estimatedHours.getMealHours(3); // Índice inválido
|
|
75
|
+
expect(invalidPart.dailyHours).toBe(0);
|
|
76
|
+
expect(invalidPart.nightlyHours).toBe(0);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("Deve retornar a soma de todas as horas de lanche quando part não for informado", () => {
|
|
80
|
+
const totalSnackHours = estimatedHours.getSnackHours();
|
|
81
|
+
expect(totalSnackHours.dailyHours).toBe(15);
|
|
82
|
+
expect(totalSnackHours.nightlyHours).toBe(5);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("Deve retornar as horas de lanche de uma parte específica", () => {
|
|
86
|
+
const part1 = estimatedHours.getSnackHours(1);
|
|
87
|
+
expect(part1.dailyHours).toBe(15);
|
|
88
|
+
expect(part1.nightlyHours).toBe(5);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("Deve retornar um objeto vazio se o índice for inválido para horas de lanche", () => {
|
|
92
|
+
const invalidPart = estimatedHours.getSnackHours(2); // Índice inválido
|
|
93
|
+
expect(invalidPart.dailyHours).toBe(0);
|
|
94
|
+
expect(invalidPart.nightlyHours).toBe(0);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Context } from '../../../data/context/context';
|
|
2
|
+
|
|
3
|
+
describe("CostCenterHistory", () => {
|
|
4
|
+
|
|
5
|
+
it('CostCenterHistory', () => {
|
|
6
|
+
const inputRule = '{"version":"1.0.0","input":{"batchId":"6af937d6-0ae9-4744-9cad-ff834de71baa","processType":"EVALUATE","startDate":"2023-07-31","endDate":"2023-07-31","contracts":[{"id":"50591a71-844c-4bf1-ac58-cd4d0fa8385e","holidaysKeys":[],"timeEvaluation":[{"date":"2023-07-31","workscheduleId":"e7875638-42b4-479d-a825-10fa3b13fbae","workscheduleWorkshiftId":"e7875638-42b4-479d-a825-10fa3b13fbae","workshiftId":"47971e5f-3d1a-4494-8cf6-328c7dfa5394","timeEvaluationSituations":[{"situationId":"209c328d-3fe8-446a-b690-846d75ef5ed5","situationCode":1,"numberOfHours":105},{"situationId":"6f3d297a-8977-4b27-a2ca-e5cb5f1489b7","situationCode":5,"numberOfHours":360},{"situationId":"acaf9c07-9521-422b-9325-1af1f36fd589","situationCode":8,"numberOfHours":30}],"clockingEvents":[{"clockingEventDate":"2023-07-31","clockingEventTime":1110,"functionCode":0,"originType":"TYPED","useType":"CLOCKING"}],"intervals":[{"clockingEventStart":"2023-07-31T08:00:00","clockingEventEnd":"2023-07-31T09:00:00","type":"ABSENCE","subType":"DELAY","situationCode":0,"situationReasonCode":0,"justifiedDays":0,"positionWorkingPart":{"workingHours":1,"part":1},"isNightly":false,"isOvertimeAuthorized":false,"isTolerancePeriod":false,"inClockingEventTolerance":false},{"clockingEventStart":"2023-07-31T09:30:00","clockingEventEnd":"2023-07-31T12:00:00","type":"ABSENCE","subType":"DELAY","situationCode":0,"situationReasonCode":0,"justifiedDays":0,"positionWorkingPart":{"workingHours":1,"part":1},"isNightly":false,"isOvertimeAuthorized":false,"isTolerancePeriod":false,"inClockingEventTolerance":false},{"clockingEventStart":"2023-07-31T13:30:00","clockingEventEnd":"2023-07-31T16:00:00","type":"ABSENCE","subType":"DELAY","situationCode":0,"situationReasonCode":0,"justifiedDays":0,"positionWorkingPart":{"workingHours":1,"part":2},"isNightly":false,"isOvertimeAuthorized":false,"isTolerancePeriod":false,"inClockingEventTolerance":false},{"clockingEventStart":"2023-07-31T16:15:00","clockingEventEnd":"2023-07-31T18:00:00","type":"WORKING","situationCode":0,"situationReasonCode":0,"justifiedDays":0,"positionWorkingPart":{"workingHours":1,"part":2},"isNightly":false,"isOvertimeAuthorized":false,"isTolerancePeriod":false,"inClockingEventTolerance":false},{"clockingEventStart":"2023-07-31T18:00:00","clockingEventEnd":"2023-07-31T18:30:00","type":"OVERTIME","subType":"CHECKOUT","situationCode":0,"situationReasonCode":0,"justifiedDays":0,"positionWorkingPart":{"workingHours":1,"part":2},"isNightly":false,"isOvertimeAuthorized":false,"isTolerancePeriod":false,"inClockingEventTolerance":false}],"situationDefinitionKey":"1_2022-08-01_null","estimatedHours":{"meal":[{"dailyHours":90,"nightlyHours":0}],"snack":[{"dailyHours":30,"nightlyHours":0},{"dailyHours":15,"nightlyHours":0}],"work":[{"dailyHours":60,"nightlyHours":0},{"dailyHours":150,"nightlyHours":0},{"dailyHours":150,"nightlyHours":0},{"dailyHours":105,"nightlyHours":0}]},"syndicateKey":"1","missingClockingEvent":true,"costCenterKey":"01"}],"employee":{"id":"50591a71-844c-4bf1-ac58-cd4d0fa8385e","code":33,"person":{"name":"Lionel Messi"},"hireDate":"2023-03-23","employmentRelationshipId":"775ee7d1-5d7f-4a1b-b50b-b659a66014b2","employer":{"code":1},"costCenterKey":"02","jobPositionCode":"1","companyBranchCode":1,"workshiftCode":1,"workshiftGroupCode":5},"histories":{"jobPositionHistories":[{"startDate":"2010-01-01","jobPositionKey":"1_1"}],"companyBranchHistories":[{"startDate":"2010-01-01","companyBranchKey":"1_1"}],"employmentRelationshipHistories":[{"startDate":"2010-01-01","employmentRelationshipId":"775ee7d1-5d7f-4a1b-b50b-b659a66014b2"}],"timeEvaluationHistories":[{"startDate":"2023-03-23","type":"NORMAL","situationDefinitionKey":["1_2022-08-01_null"]}],"workshiftHistories":[{"startDate":"2010-01-01","workshiftId":"47971e5f-3d1a-4494-8cf6-328c7dfa5394","workshiftGroupsCode":1}],"costCenterHistories":[{"startDate":"2010-01-01","endDate":"2023-07-31","costCenterKey":"01"},{"startDate":"2023-08-01","costCenterKey":"02"}]},"schedules":{"bridges":[],"workscheduleChanges":[],"workshiftChanges":[]},"hourBankAccounts":[{"hourBank":{"code":8},"creationDate":"2024-04-24"},{"hourBank":{"code":1},"creationDate":"2024-12-01"}]}],"database":{"situations":[{"id":"209c328d-3fe8-446a-b690-846d75ef5ed5","code":1,"type":"WORKING","exception":false,"complementarySituationId":"209c328d-3fe8-446a-b690-846d75ef5ed5","daytime":true},{"id":"6774bc30-d9db-4d52-ade2-9d3e5059e0ab","code":3,"type":"OVERTIME","exception":true,"complementarySituationId":"acaf9c07-9521-422b-9325-1af1f36fd589","daytime":false},{"id":"6f3d297a-8977-4b27-a2ca-e5cb5f1489b7","code":5,"type":"ABSENCES","exception":true,"complementarySituationId":"6f3d297a-8977-4b27-a2ca-e5cb5f1489b7","daytime":true},{"id":"a6e0401f-42f2-4dc8-ad48-c48682029689","code":6,"type":"WORKING","exception":true,"complementarySituationId":"a6e0401f-42f2-4dc8-ad48-c48682029689","daytime":false},{"id":"acaf9c07-9521-422b-9325-1af1f36fd589","code":8,"type":"OVERTIME","exception":true,"complementarySituationId":"6774bc30-d9db-4d52-ade2-9d3e5059e0ab","daytime":true},{"id":"489eab83-47ed-42ee-ab76-a1702bd13e79","code":9,"type":"VACATION","exception":false,"complementarySituationId":"489eab83-47ed-42ee-ab76-a1702bd13e79","daytime":true},{"id":"4be78b2c-cae5-46f8-93ae-850a1c85013a","code":11,"type":"WORKING","exception":true,"complementarySituationId":"4be78b2c-cae5-46f8-93ae-850a1c85013a","daytime":true},{"id":"848ec42d-b2df-4c4d-94f4-151f381e4a54","code":12,"type":"WORKING","exception":false,"complementarySituationId":"848ec42d-b2df-4c4d-94f4-151f381e4a54","daytime":true},{"id":"8cb7c936-a263-4845-979e-9c69d663b4a2","code":15,"type":"WORKING","exception":false,"complementarySituationId":"e63bd904-4cc8-4bc0-9e2d-b087f6fc0f81","daytime":true},{"id":"e63bd904-4cc8-4bc0-9e2d-b087f6fc0f81","code":16,"type":"WORKING","exception":false,"complementarySituationId":"8cb7c936-a263-4845-979e-9c69d663b4a2","daytime":false},{"id":"e75ba021-148e-4f36-bb3e-13e024cc1908","code":20,"type":"WORKING","exception":true,"complementarySituationId":"2a2fae76-cf7e-498b-9107-0166f6e906ef","daytime":true},{"id":"2a2fae76-cf7e-498b-9107-0166f6e906ef","code":21,"type":"WORKING","exception":true,"complementarySituationId":"e75ba021-148e-4f36-bb3e-13e024cc1908","daytime":false},{"id":"950ba6cd-528d-42cc-aa07-9f15561735f9","code":999,"type":"TIMEEVALUATIONSITUATION","exception":true,"complementarySituationId":"950ba6cd-528d-42cc-aa07-9f15561735f9","daytime":true}],"holidays":[],"timeEvaluationSituationDefinitions":[{"code":1,"startDate":"2022-08-01","workSituationId":"209c328d-3fe8-446a-b690-846d75ef5ed5","nightShiftWorkPremiumId":"2a2fae76-cf7e-498b-9107-0166f6e906ef","invalidEventsSituationId":"950ba6cd-528d-42cc-aa07-9f15561735f9","vacationPaidLeaveSituationId":"489eab83-47ed-42ee-ab76-a1702bd13e79","dailyRestViolationSituationId":"848ec42d-b2df-4c4d-94f4-151f381e4a54","workBreakViolationSituationId":"4be78b2c-cae5-46f8-93ae-850a1c85013a","absenceSituationId":"6f3d297a-8977-4b27-a2ca-e5cb5f1489b7","tardinessSituationId":"6f3d297a-8977-4b27-a2ca-e5cb5f1489b7","intermediateLeaveSituationId":"6f3d297a-8977-4b27-a2ca-e5cb5f1489b7","earlyLeaveSituationId":"6f3d297a-8977-4b27-a2ca-e5cb5f1489b7","absenceSituationOnRelayScheduleHolidaysId":"6f3d297a-8977-4b27-a2ca-e5cb5f1489b7","percentageNextDay":false,"normalOvertimeSeparationLimit":10,"separateOvertimeAfterConvertingNightShiftHours":false,"unauthorizedOvertimeId":"acaf9c07-9521-422b-9325-1af1f36fd589","overtimeBeforeId":"6774bc30-d9db-4d52-ade2-9d3e5059e0ab","overtimeEntryId":"6774bc30-d9db-4d52-ade2-9d3e5059e0ab","overtimeDuringMealId":"6774bc30-d9db-4d52-ade2-9d3e5059e0ab","leaveOvertimeId":"6774bc30-d9db-4d52-ade2-9d3e5059e0ab","overtimeAfterId":"a6e0401f-42f2-4dc8-ad48-c48682029689","overtimeSeparationLimitDuringRest":10,"overtimeDuringRestId":"a6e0401f-42f2-4dc8-ad48-c48682029689","overtimeSeparationLimitDuringCompensatedDays":10,"overtimeOnCompensatedDaysId":"a6e0401f-42f2-4dc8-ad48-c48682029689","overtimeSeparationLimitDuringHoliday":10,"overtimeDuringHolidayId":"a6e0401f-42f2-4dc8-ad48-c48682029689","overtimeSeparationLimitDuringDayOff":10,"overtimeDuringDayOffId":"a6e0401f-42f2-4dc8-ad48-c48682029689","overtimeSituationOnRelayScheduleHolidaysId":"6774bc30-d9db-4d52-ade2-9d3e5059e0ab","nightShiftOvertimePremiumSituationId":"a6e0401f-42f2-4dc8-ad48-c48682029689","overtimeSeparationBeforeId":"8cb7c936-a263-4845-979e-9c69d663b4a2","overtimeSeparationEntryId":"8cb7c936-a263-4845-979e-9c69d663b4a2","overtimeSeparationDuringMealId":"8cb7c936-a263-4845-979e-9c69d663b4a2","overtimeSeparationLeaveId":"8cb7c936-a263-4845-979e-9c69d663b4a2","overtimeSeparationAfterId":"8cb7c936-a263-4845-979e-9c69d663b4a2","overtimeSeparationDuringRestId":"8cb7c936-a263-4845-979e-9c69d663b4a2","overtimeSeparationDuringCompensatedDaysId":"8cb7c936-a263-4845-979e-9c69d663b4a2","overtimeSeparationDuringHolidayId":"8cb7c936-a263-4845-979e-9c69d663b4a2","overtimeSeparationDuringDayOffId":"8cb7c936-a263-4845-979e-9c69d663b4a2"}],"jobPositions":[{"key":"1_1","code":1,"structureCode":1}],"workschedules":[{"id":"e7875638-42b4-479d-a825-10fa3b13fbae","code":1,"workload":465,"type":"RIGID","definitionType":"NORMAL","clockingRegisters":[{"sequence":1,"clockingEvent":480,"toleranceBefore":480,"toleranceAfter":480,"mobilityBefore":0,"mobilityAfter":0,"clockingEventScheduleType":"MANDATORY","usingType":"MANDATORY_ENTRY_OR_EXIT"},{"sequence":2,"clockingEvent":540,"toleranceBefore":540,"toleranceAfter":540,"mobilityBefore":0,"mobilityAfter":0,"intervalType":"RIGID","clockingEventScheduleType":"NOM_MANDATORY","usingType":"NON_MANDATORY_SNACK"},{"sequence":3,"clockingEvent":570,"toleranceBefore":570,"toleranceAfter":570,"mobilityBefore":0,"mobilityAfter":0,"intervalType":"RIGID","clockingEventScheduleType":"NOM_MANDATORY","usingType":"NON_MANDATORY_SNACK"},{"sequence":4,"clockingEvent":720,"toleranceBefore":720,"toleranceAfter":720,"mobilityBefore":0,"mobilityAfter":0,"intervalType":"RIGID","clockingEventScheduleType":"MANDATORY","usingType":"MANDATORY_MEAL"},{"sequence":5,"clockingEvent":810,"toleranceBefore":810,"toleranceAfter":810,"mobilityBefore":0,"mobilityAfter":0,"intervalType":"RIGID","clockingEventScheduleType":"MANDATORY","usingType":"MANDATORY_MEAL"},{"sequence":6,"clockingEvent":960,"toleranceBefore":960,"toleranceAfter":960,"mobilityBefore":0,"mobilityAfter":0,"intervalType":"RIGID","clockingEventScheduleType":"NOM_MANDATORY","usingType":"NON_MANDATORY_SNACK"},{"sequence":7,"clockingEvent":975,"toleranceBefore":975,"toleranceAfter":975,"mobilityBefore":0,"mobilityAfter":0,"intervalType":"RIGID","clockingEventScheduleType":"NOM_MANDATORY","usingType":"NON_MANDATORY_SNACK"},{"sequence":8,"clockingEvent":1080,"toleranceBefore":1080,"toleranceAfter":1080,"mobilityBefore":0,"mobilityAfter":0,"clockingEventScheduleType":"MANDATORY","usingType":"MANDATORY_ENTRY_OR_EXIT"}],"clockingEvent":{"workStartEndOvertimeTolerance":10,"mealOvertimeTolerance":11,"overtimeDailyTotalTolerance":12,"absenceDailyTotalTolerance":15,"workStartEndAbsenceTolerance":0,"mealAbsenceTolerance":0}}],"workshifts":[{"id":"47971e5f-3d1a-4494-8cf6-328c7dfa5394","code":1,"type":"PERMANENT","rotationWorkShift":true,"extensionNightHours":true,"dsrMinutes":440,"weekMinutes":2640,"monthMinutes":13200,"timeShiftType":"GENERAL","workshiftGroups":[{"code":1,"baseDate":"2022-08-01"},{"code":2,"baseDate":"2022-08-08"},{"code":3,"baseDate":"2022-08-15"},{"code":4,"baseDate":"1901-01-08"},{"code":4,"baseDate":"2022-08-22"},{"code":5,"baseDate":"2023-03-22"},{"code":5,"baseDate":"2022-08-29"},{"code":6,"baseDate":"2022-09-05"}],"workshiftDetails":[{"holidayGroup":{"code":2},"holidayType":"OWN","startDate":"2022-08-12"}]}],"companyBranches":[{"key":"1_1","code":1}],"syndicates":[{"key":"1","code":1,"nightStartHour":1320,"nightEndHour":300,"minimumInterval4to6Hours":30,"minimumInterval6Hours":90,"minimumWorkDuration6Hours":361}],"employmentRelationships":[{"id":"775ee7d1-5d7f-4a1b-b50b-b659a66014b2","code":"1","contractType":"EMPLOYEE"}],"costCenters":[{"code":"01"},{"code":"02"}]},"currentUser":{"userName":"admin@allanalves.com.br"}}}';
|
|
7
|
+
|
|
8
|
+
const context = new Context({body: inputRule});
|
|
9
|
+
const contract = context.contracts[0];
|
|
10
|
+
const costCenterHistories = contract.histories.costCenterHistories;
|
|
11
|
+
|
|
12
|
+
// históricos
|
|
13
|
+
expect(costCenterHistories.length).toBe(2);
|
|
14
|
+
expect(costCenterHistories[0].costCenter.code).toBe("01");
|
|
15
|
+
expect(costCenterHistories[0].startDate).toEqual(new Date("2010-01-01"));
|
|
16
|
+
expect(costCenterHistories[0].endDate).toEqual(new Date("2023-07-31"));
|
|
17
|
+
|
|
18
|
+
expect(costCenterHistories[1].costCenter.code).toBe("02");
|
|
19
|
+
expect(costCenterHistories[1].startDate).toEqual(new Date("2023-08-01"));
|
|
20
|
+
expect(costCenterHistories[1].endDate).toBeNull();
|
|
21
|
+
|
|
22
|
+
// employee atual
|
|
23
|
+
expect(contract.employee.costCenter.code).toBe("02");
|
|
24
|
+
|
|
25
|
+
// na data da apuração
|
|
26
|
+
expect(contract.timeEvaluation[0].costCenter.code).toBe("01");
|
|
27
|
+
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
|