@seniorsistemas/exclusion-process-component 0.0.1-c049d10c-e93a-4d63-9c2a-b17bca40c324 → 0.6.0-44030ff3-2eeb-49f7-8927-0920cc01a805
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/.editorconfig +19 -0
- package/.gitlab-ci.yml +74 -0
- package/.prettierrc +8 -0
- package/.senior-ci-extensions.sh +21 -0
- package/.vscode/settings.json +6 -0
- package/CHANGELOG.md +22 -0
- package/README.md +16 -0
- package/angular.json +144 -0
- package/archive.tar.gz +0 -0
- package/e2e/app.e2e-spec.ts +14 -0
- package/e2e/app.po.ts +11 -0
- package/e2e/tsconfig.e2e.json +14 -0
- package/karma.conf.js +53 -0
- package/lib/.browserslistrc +5 -0
- package/lib/package.json +19 -0
- package/{enums/enum-exclusion-process-status.d.ts → lib/src/enums/enum-exclusion-process-status.ts} +1 -1
- package/lib/src/exclusion-details/exclusion-details.component.html +84 -0
- package/lib/src/exclusion-details/exclusion-details.component.scss +47 -0
- package/lib/src/exclusion-details/exclusion-details.component.spec.ts +171 -0
- package/lib/src/exclusion-details/exclusion-details.component.ts +235 -0
- package/lib/src/exclusion-details/exclusion-details.module.ts +23 -0
- package/{exclusion-details/protocols/exclusion-details.d.ts → lib/src/exclusion-details/protocols/exclusion-details.ts} +1 -0
- package/{exclusion-details/protocols/show-details-information.d.ts → lib/src/exclusion-details/protocols/show-details-information.ts} +1 -1
- package/lib/src/exclusions-list/exclusions-list.component.html +157 -0
- package/lib/src/exclusions-list/exclusions-list.component.spec.ts +526 -0
- package/lib/src/exclusions-list/exclusions-list.component.ts +335 -0
- package/lib/src/exclusions-list/exclusions-list.module.ts +52 -0
- package/lib/src/exclusions-list/exclusions-list.routing.ts +89 -0
- package/lib/src/exclusions-list/index.ts +2 -0
- package/lib/src/logical-delete.module.ts +22 -0
- package/{models/exclusion-process-step-group.d.ts → lib/src/models/exclusion-process-step-group.ts} +1 -0
- package/{models/exclusion-process-step.d.ts → lib/src/models/exclusion-process-step.ts} +1 -0
- package/{models/exclusion-process.d.ts → lib/src/models/exclusion-process.ts} +1 -0
- package/{models/list-params.d.ts → lib/src/models/list-params.ts} +1 -0
- package/{models/project-config.d.ts → lib/src/models/project-config.ts} +3 -1
- package/lib/src/services/filter.service.spec.ts +290 -0
- package/lib/src/services/filter.service.ts +109 -0
- package/lib/src/services/index.ts +1 -0
- package/lib/src/services/logical-delete-config.service.spec.ts +59 -0
- package/lib/src/services/logical-delete-config.service.ts +25 -0
- package/lib/src/services/logical-delete.service.spec.ts +322 -0
- package/lib/src/services/logical-delete.service.ts +122 -0
- package/lib/test.ts +14 -0
- package/lib/tsconfig.lib.json +19 -0
- package/lib/tsconfig.lib.prod.json +6 -0
- package/lib/tsconfig.spec.json +12 -0
- package/lib/tslint.json +19 -0
- package/package.json +59 -18
- package/protractor.conf.js +28 -0
- package/senior-ci/.devcontainer/Dockerfile +27 -0
- package/senior-ci/.devcontainer/devcontainer.json +71 -0
- package/senior-ci/.editorconfig +14 -0
- package/senior-ci/.gitattributes +5 -0
- package/senior-ci/.gitlab-ci.yml +53 -0
- package/senior-ci/.pylintrc +562 -0
- package/senior-ci/.vscode/launch.json +102 -0
- package/senior-ci/CHANGELOG.md +1564 -0
- package/senior-ci/CONTRIBUTING.md +31 -0
- package/senior-ci/README.md +26 -0
- package/senior-ci/ci/ci.sh +74 -0
- package/senior-ci/ci/sonar_scanner.py +48 -0
- package/senior-ci/common/__init__.py +250 -0
- package/senior-ci/common/default-files/pom.xml +10 -0
- package/senior-ci/common/docker-helpers.sh +57 -0
- package/senior-ci/common/extensions.py +88 -0
- package/senior-ci/common/flutter-helpers.sh +3 -0
- package/senior-ci/common/getopt_helper.py +168 -0
- package/senior-ci/common/graphql_client.py +40 -0
- package/senior-ci/common/helm_helpers.py +40 -0
- package/senior-ci/common/notification-helpers.sh +15 -0
- package/senior-ci/common/npm-helper.sh +4 -0
- package/senior-ci/common/parallel-helper.sh +8 -0
- package/senior-ci/common/release-helpers.sh +196 -0
- package/senior-ci/common/s3cache-helpers.sh +47 -0
- package/senior-ci/common/senior-ci-extensions-helpers.sh +15 -0
- package/senior-ci/common/sonar_helper.py +203 -0
- package/senior-ci/common/validations/buildable_project.py +61 -0
- package/senior-ci/common/validations/check_deprecated_primitives.py +49 -0
- package/senior-ci/common/validations/check_project_path.py +40 -0
- package/senior-ci/common/validations/check_sonar_config_files.py +41 -0
- package/senior-ci/common/validations/check_tags.py +41 -0
- package/senior-ci/common/validations/validate_changelog.py +151 -0
- package/senior-ci/common/validations/validate_issues.py +320 -0
- package/senior-ci/docker/build.sh +18 -0
- package/senior-ci/docker/config-host.sh +29 -0
- package/senior-ci/docker/deploy-service.sh +79 -0
- package/senior-ci/docker/push.sh +22 -0
- package/senior-ci/frontend/npm/bibliotecas/ci.sh +149 -0
- package/senior-ci/frontend/npm/ci.sh +370 -0
- package/senior-ci/frontend/npm/release-translations.sh +164 -0
- package/senior-ci/helm/deploy.py +56 -0
- package/senior-ci/helm/publish.py +41 -0
- package/senior-ci/hook/release_notification.sh +88 -0
- package/senior-ci/hook/text_notification.sh +10 -0
- package/senior-ci/java/bibliotecas/ci.sh +215 -0
- package/senior-ci/java/sdl/ci.sh +372 -0
- package/senior-ci/java/sdl/scripts/hotfix.sh +78 -0
- package/senior-ci/mobile/flutter/apps/__main__.py +5 -0
- package/senior-ci/mobile/flutter/apps/ci.py +193 -0
- package/senior-ci/mobile/flutter/libs/__main__.py +5 -0
- package/senior-ci/mobile/flutter/libs/ci.py +178 -0
- package/senior-ci/mobile/flutter/scripts/release.sh +54 -0
- package/senior-ci/release-candidate/backend/get_version.sh +64 -0
- package/senior-ci/release-candidate/close_branch.sh +113 -0
- package/senior-ci/release-candidate/common/create_hotfix.sh +28 -0
- package/senior-ci/release-candidate/common/create_release.sh +30 -0
- package/senior-ci/release-candidate/create_branch.sh +64 -0
- package/senior-ci/release-candidate/frontend/get_version.sh +43 -0
- package/senior-ci/requirements-dev.txt +5 -0
- package/senior-ci/requirements.txt +5 -0
- package/senior-ci/scripts/apply_yamls.py +229 -0
- package/senior-ci/scripts/create_sre_issue/__main__.py +7 -0
- package/senior-ci/scripts/create_sre_issue/create_sre_issue.py +267 -0
- package/senior-ci/scripts/create_sre_issue/helpers.py +166 -0
- package/senior-ci/scripts/create_sre_issue/jira_manager.py +37 -0
- package/senior-ci/scripts/validate_changelog.sh +3 -0
- package/senior-ci/sonar-project.properties +1 -0
- package/server.js +5 -0
- package/sonar-project.properties +10 -0
- package/src/app/app.component.html +43 -0
- package/src/app/app.component.scss +36 -0
- package/src/app/app.component.ts +56 -0
- package/src/app/app.module.ts +64 -0
- package/src/app/shared/shared.module.ts +28 -0
- package/src/environments/environment.default.ts +3 -0
- package/src/environments/environment.prod.ts +6 -0
- package/src/environments/environment.ts +7 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +17 -0
- package/src/locale/en-US.json +3 -0
- package/src/locale/es-ES.json +3 -0
- package/src/locale/pt-BR.json +3 -0
- package/src/main.ts +13 -0
- package/src/polyfills.ts +58 -0
- package/src/styles.scss +11 -0
- package/src/tsconfig.app.json +21 -0
- package/src/typings.d.ts +15 -0
- package/tsconfig.json +39 -0
- package/tslint.json +80 -0
- package/bundles/seniorsistemas-exclusion-process-component.umd.js +0 -747
- package/bundles/seniorsistemas-exclusion-process-component.umd.js.map +0 -1
- package/bundles/seniorsistemas-exclusion-process-component.umd.min.js +0 -16
- package/bundles/seniorsistemas-exclusion-process-component.umd.min.js.map +0 -1
- package/esm2015/enums/enum-exclusion-process-status.js +0 -8
- package/esm2015/exclusion-details/exclusion-details.component.js +0 -216
- package/esm2015/exclusion-details/exclusion-details.module.js +0 -28
- package/esm2015/exclusion-details/index.js +0 -3
- package/esm2015/exclusion-details/protocols/exclusion-details.js +0 -1
- package/esm2015/exclusion-details/protocols/index.js +0 -2
- package/esm2015/exclusion-details/protocols/show-details-information.js +0 -3
- package/esm2015/logical-delete.module.js +0 -27
- package/esm2015/models/exclusion-process-step-group.js +0 -1
- package/esm2015/models/exclusion-process-step.js +0 -1
- package/esm2015/models/exclusion-process.js +0 -1
- package/esm2015/models/index.js +0 -1
- package/esm2015/models/list-params.js +0 -1
- package/esm2015/models/list-result.js +0 -1
- package/esm2015/models/project-config.js +0 -3
- package/esm2015/public-api.js +0 -3
- package/esm2015/seniorsistemas-exclusion-process-component.js +0 -9
- package/esm2015/services/filter.service.js +0 -104
- package/esm2015/services/logical-delete-config.service.js +0 -29
- package/esm2015/services/logical-delete.service.js +0 -109
- package/esm5/enums/enum-exclusion-process-status.js +0 -8
- package/esm5/exclusion-details/exclusion-details.component.js +0 -235
- package/esm5/exclusion-details/exclusion-details.module.js +0 -31
- package/esm5/exclusion-details/index.js +0 -3
- package/esm5/exclusion-details/protocols/exclusion-details.js +0 -1
- package/esm5/exclusion-details/protocols/index.js +0 -2
- package/esm5/exclusion-details/protocols/show-details-information.js +0 -7
- package/esm5/logical-delete.module.js +0 -31
- package/esm5/models/exclusion-process-step-group.js +0 -1
- package/esm5/models/exclusion-process-step.js +0 -1
- package/esm5/models/exclusion-process.js +0 -1
- package/esm5/models/index.js +0 -1
- package/esm5/models/list-params.js +0 -1
- package/esm5/models/list-result.js +0 -1
- package/esm5/models/project-config.js +0 -3
- package/esm5/public-api.js +0 -3
- package/esm5/seniorsistemas-exclusion-process-component.js +0 -9
- package/esm5/services/filter.service.js +0 -109
- package/esm5/services/logical-delete-config.service.js +0 -30
- package/esm5/services/logical-delete.service.js +0 -112
- package/exclusion-details/exclusion-details.component.d.ts +0 -49
- package/exclusion-details/exclusion-details.module.d.ts +0 -2
- package/fesm2015/seniorsistemas-exclusion-process-component.js +0 -495
- package/fesm2015/seniorsistemas-exclusion-process-component.js.map +0 -1
- package/fesm5/seniorsistemas-exclusion-process-component.js +0 -530
- package/fesm5/seniorsistemas-exclusion-process-component.js.map +0 -1
- package/logical-delete.module.d.ts +0 -5
- package/seniorsistemas-exclusion-process-component.d.ts +0 -8
- package/seniorsistemas-exclusion-process-component.metadata.json +0 -1
- package/services/filter.service.d.ts +0 -19
- package/services/logical-delete-config.service.d.ts +0 -8
- package/services/logical-delete.service.d.ts +0 -20
- /package/{exclusion-details/index.d.ts → lib/src/exclusion-details/index.ts} +0 -0
- /package/{exclusion-details/protocols/index.d.ts → lib/src/exclusion-details/protocols/index.ts} +0 -0
- /package/{models/index.d.ts → lib/src/models/index.ts} +0 -0
- /package/{models/list-result.d.ts → lib/src/models/list-result.ts} +0 -0
- /package/{public-api.d.ts → lib/src/public-api.ts} +0 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
import { ChangeDetectorRef } from "@angular/core";
|
|
2
|
+
import { ComponentFixture, TestBed } from "@angular/core/testing";
|
|
3
|
+
import { RouterTestingModule } from "@angular/router/testing";
|
|
4
|
+
import { FormBuilder, FormsModule, ReactiveFormsModule} from "@angular/forms";
|
|
5
|
+
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
|
|
6
|
+
import { ActivatedRoute, RouterModule } from "@angular/router";
|
|
7
|
+
import { TranslateModule, TranslateService } from "@ngx-translate/core";
|
|
8
|
+
import {
|
|
9
|
+
AngularComponentsModule,
|
|
10
|
+
ButtonModule,
|
|
11
|
+
ControlErrorsModule,
|
|
12
|
+
CustomFieldsModule,
|
|
13
|
+
DynamicFormModule,
|
|
14
|
+
EmptyStateModule,
|
|
15
|
+
InfoSignModule,
|
|
16
|
+
LoadingStateModule,
|
|
17
|
+
TokenListModule,
|
|
18
|
+
NumberInputModule,
|
|
19
|
+
TableModule as SeniorTableModule
|
|
20
|
+
} from "@seniorsistemas/angular-components";
|
|
21
|
+
import { MessageService } from "primeng/api";
|
|
22
|
+
import { HttpClientTestingModule } from "@angular/common/http/testing";
|
|
23
|
+
import { Observable } from "rxjs";
|
|
24
|
+
import { CommonModule } from "@angular/common";
|
|
25
|
+
import { CurrencyMaskModule } from "@seniorsistemas/ng2-currency-mask";
|
|
26
|
+
import { CyclicJsonInterceptorModule } from "@seniorsistemas/platform-components";
|
|
27
|
+
import { PanelModule } from "primeng/panel";
|
|
28
|
+
import { InputTextModule } from "primeng/inputtext";
|
|
29
|
+
import { HotkeyModule } from "angular2-hotkeys";
|
|
30
|
+
import { TabViewModule } from "primeng/tabview";
|
|
31
|
+
import { DropdownModule } from "primeng/dropdown";
|
|
32
|
+
import { CalendarModule } from "primeng/calendar";
|
|
33
|
+
import { KeyFilterModule } from "primeng/keyfilter";
|
|
34
|
+
import { MultiSelectModule } from "primeng/multiselect";
|
|
35
|
+
import { ConfirmDialogModule } from "primeng/confirmdialog";
|
|
36
|
+
import { TableModule } from "primeng/table";
|
|
37
|
+
import { DialogModule } from "primeng/dialog";
|
|
38
|
+
import { InputTextareaModule } from "primeng/inputtextarea";
|
|
39
|
+
import { CheckboxModule } from "primeng/checkbox";
|
|
40
|
+
import { ExclusionDetailsModule } from "../exclusion-details";
|
|
41
|
+
import { FilterService } from "../services/filter.service";
|
|
42
|
+
import { LogicalDeleteConfigService } from "../services/logical-delete-config.service";
|
|
43
|
+
import { RadioButtonModule } from "primeng/radiobutton";
|
|
44
|
+
import { ExclusionsListComponent } from "./exclusions-list.component";
|
|
45
|
+
import { ProjectConfigs, ProjectConfigsInjectionToken } from "../models/project-config";
|
|
46
|
+
import { LogicalDeleteService } from "../services";
|
|
47
|
+
import { EnumExclusionProcessStatus } from "../enums/enum-exclusion-process-status";
|
|
48
|
+
import { ExclusionProcess } from "../models";
|
|
49
|
+
|
|
50
|
+
describe("ExclusionsListComponent", () => {
|
|
51
|
+
let fixture: ComponentFixture<ExclusionsListComponent> = null;
|
|
52
|
+
let component: ExclusionsListComponent = null;
|
|
53
|
+
let logicalDeleteService: LogicalDeleteService = null;
|
|
54
|
+
|
|
55
|
+
let fakeActivatedRoute: any = {};
|
|
56
|
+
|
|
57
|
+
const defaultProjectConfigs: ProjectConfigs = {
|
|
58
|
+
domain: "domain",
|
|
59
|
+
service: "service"
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
beforeEach(async () => {
|
|
63
|
+
fakeActivatedRoute = {
|
|
64
|
+
data: new Observable(subscriber => {
|
|
65
|
+
subscriber.next({
|
|
66
|
+
localeConfig: {
|
|
67
|
+
calendar: {},
|
|
68
|
+
number: {
|
|
69
|
+
scale: 1,
|
|
70
|
+
decimalSeparator: ","
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
subscriber.complete();
|
|
75
|
+
}),
|
|
76
|
+
params: new Observable(subscriber => {
|
|
77
|
+
subscriber.next({entityName: "entityName"});
|
|
78
|
+
subscriber.complete();
|
|
79
|
+
}),
|
|
80
|
+
queryParams: new Observable(subscriber => {
|
|
81
|
+
subscriber.next({entityDescription: "entityDescription"});
|
|
82
|
+
subscriber.complete();
|
|
83
|
+
})
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
await TestBed.configureTestingModule({
|
|
87
|
+
imports: [
|
|
88
|
+
AngularComponentsModule.forRoot({
|
|
89
|
+
domain: "domain",
|
|
90
|
+
service: "service"
|
|
91
|
+
}),
|
|
92
|
+
ButtonModule,
|
|
93
|
+
TranslateModule.forRoot(),
|
|
94
|
+
RouterModule,
|
|
95
|
+
RouterTestingModule,
|
|
96
|
+
HttpClientTestingModule,
|
|
97
|
+
ExclusionDetailsModule,
|
|
98
|
+
BrowserAnimationsModule,
|
|
99
|
+
|
|
100
|
+
FormsModule,
|
|
101
|
+
ReactiveFormsModule,
|
|
102
|
+
CommonModule,
|
|
103
|
+
CurrencyMaskModule,
|
|
104
|
+
TranslateModule,
|
|
105
|
+
CustomFieldsModule,
|
|
106
|
+
ControlErrorsModule,
|
|
107
|
+
EmptyStateModule,
|
|
108
|
+
DynamicFormModule,
|
|
109
|
+
TokenListModule,
|
|
110
|
+
PanelModule,
|
|
111
|
+
InputTextModule,
|
|
112
|
+
InputTextareaModule,
|
|
113
|
+
ButtonModule,
|
|
114
|
+
InfoSignModule,
|
|
115
|
+
CheckboxModule,
|
|
116
|
+
TableModule,
|
|
117
|
+
ConfirmDialogModule,
|
|
118
|
+
CalendarModule,
|
|
119
|
+
DropdownModule,
|
|
120
|
+
TabViewModule,
|
|
121
|
+
HotkeyModule,
|
|
122
|
+
LoadingStateModule,
|
|
123
|
+
NumberInputModule,
|
|
124
|
+
CyclicJsonInterceptorModule,
|
|
125
|
+
DialogModule,
|
|
126
|
+
KeyFilterModule,
|
|
127
|
+
RadioButtonModule,
|
|
128
|
+
SeniorTableModule,
|
|
129
|
+
MultiSelectModule,
|
|
130
|
+
],
|
|
131
|
+
providers: [
|
|
132
|
+
TranslateService,
|
|
133
|
+
MessageService,
|
|
134
|
+
FormBuilder,
|
|
135
|
+
ChangeDetectorRef,
|
|
136
|
+
FilterService,
|
|
137
|
+
LogicalDeleteConfigService,
|
|
138
|
+
LogicalDeleteService,
|
|
139
|
+
{
|
|
140
|
+
provide: ActivatedRoute,
|
|
141
|
+
useValue: fakeActivatedRoute
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
provide: ProjectConfigsInjectionToken,
|
|
145
|
+
useValue: defaultProjectConfigs
|
|
146
|
+
}
|
|
147
|
+
],
|
|
148
|
+
declarations: [ExclusionsListComponent]
|
|
149
|
+
}).compileComponents();
|
|
150
|
+
|
|
151
|
+
logicalDeleteService = TestBed.inject(LogicalDeleteService);
|
|
152
|
+
|
|
153
|
+
fixture = TestBed.createComponent(ExclusionsListComponent);
|
|
154
|
+
component = fixture.componentInstance;
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const mockDefaultListExclusionsCall = (contents: ExclusionProcess[] = [], totalElements: number = 0) => {
|
|
158
|
+
const spy = spyOn(logicalDeleteService, "listExclusions")
|
|
159
|
+
.and.returnValue(new Observable(subscriber => {
|
|
160
|
+
subscriber.next({
|
|
161
|
+
totalElements,
|
|
162
|
+
contents,
|
|
163
|
+
totalPages: 0
|
|
164
|
+
});
|
|
165
|
+
return subscriber.complete();
|
|
166
|
+
}));
|
|
167
|
+
return spy;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
describe("Component constructor", () => {
|
|
171
|
+
it("should create component", () => {
|
|
172
|
+
mockDefaultListExclusionsCall();
|
|
173
|
+
fixture.detectChanges(false);
|
|
174
|
+
expect(component).toBeTruthy();
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it("should read locale from route data", () => {
|
|
178
|
+
fakeActivatedRoute.data = new Observable(subscriber => {
|
|
179
|
+
subscriber.next({
|
|
180
|
+
localeConfig: {
|
|
181
|
+
calendar: {},
|
|
182
|
+
number: {
|
|
183
|
+
scale: 1,
|
|
184
|
+
decimalSeparator: ","
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
subscriber.complete();
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
mockDefaultListExclusionsCall();
|
|
192
|
+
fixture.detectChanges(false);
|
|
193
|
+
expect(component.locale.number.scale).toBe(1);
|
|
194
|
+
expect(component.locale.number.decimalSeparator).toBe(",");
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
it("should read entityName from params", () => {
|
|
198
|
+
fakeActivatedRoute.params = new Observable(subscriber => {
|
|
199
|
+
subscriber.next({
|
|
200
|
+
entityName: "valid entity name"
|
|
201
|
+
});
|
|
202
|
+
subscriber.complete();
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
mockDefaultListExclusionsCall();
|
|
206
|
+
fixture.detectChanges(false);
|
|
207
|
+
expect(component.entityName).toBe("valid entity name");
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it("should read entityDescription from queryParams", () => {
|
|
211
|
+
fakeActivatedRoute.queryParams = new Observable(subscriber => {
|
|
212
|
+
subscriber.next({
|
|
213
|
+
entityDescription: "valid entity description"
|
|
214
|
+
});
|
|
215
|
+
subscriber.complete();
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
mockDefaultListExclusionsCall();
|
|
219
|
+
fixture.detectChanges(false);
|
|
220
|
+
expect(component.entityDescription).toBe("valid entity description");
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
describe("Filters", () => {
|
|
225
|
+
it("should filter by description", () => {
|
|
226
|
+
const listExclusionsSpy = mockDefaultListExclusionsCall();
|
|
227
|
+
fixture.detectChanges(false);
|
|
228
|
+
|
|
229
|
+
component.filterFormGroup.controls["description"].setValue("Teste");
|
|
230
|
+
const filterButton = fixture.nativeElement.querySelector("#filter-button");
|
|
231
|
+
filterButton.dispatchEvent(new Event("click"));
|
|
232
|
+
expect(listExclusionsSpy).toHaveBeenCalledWith(
|
|
233
|
+
"entityName",
|
|
234
|
+
{
|
|
235
|
+
page: 0,
|
|
236
|
+
size: 10,
|
|
237
|
+
sort: [],
|
|
238
|
+
filterQuery: "containing(upper(description), upper('Teste'))",
|
|
239
|
+
displayFields: ["recordId", "description", "status", "startDate", "finishDate"]
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
it("should filter by single state enum", () => {
|
|
245
|
+
const listExclusionsSpy = mockDefaultListExclusionsCall();
|
|
246
|
+
fixture.detectChanges(false);
|
|
247
|
+
|
|
248
|
+
component.filterFormGroup.controls["state"].setValue([EnumExclusionProcessStatus.PENDING]);
|
|
249
|
+
const filterButton = fixture.nativeElement.querySelector("#filter-button");
|
|
250
|
+
filterButton.dispatchEvent(new Event("click"));
|
|
251
|
+
expect(listExclusionsSpy).toHaveBeenCalledWith(
|
|
252
|
+
"entityName",
|
|
253
|
+
{
|
|
254
|
+
page: 0,
|
|
255
|
+
size: 10,
|
|
256
|
+
sort: [],
|
|
257
|
+
filterQuery: `(state eq '${EnumExclusionProcessStatus.PENDING}')`,
|
|
258
|
+
displayFields: ["recordId", "description", "status", "startDate", "finishDate"]
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it("should filter by multiple state enum", () => {
|
|
264
|
+
const listExclusionsSpy = mockDefaultListExclusionsCall();
|
|
265
|
+
fixture.detectChanges(false);
|
|
266
|
+
|
|
267
|
+
component.filterFormGroup.controls["state"].setValue([
|
|
268
|
+
EnumExclusionProcessStatus.PENDING, EnumExclusionProcessStatus.PROCESSING
|
|
269
|
+
]);
|
|
270
|
+
const filterButton = fixture.nativeElement.querySelector("#filter-button");
|
|
271
|
+
filterButton.dispatchEvent(new Event("click"));
|
|
272
|
+
|
|
273
|
+
const filter = `(state eq '${EnumExclusionProcessStatus.PENDING}' or state eq '${EnumExclusionProcessStatus.PROCESSING}')`;
|
|
274
|
+
|
|
275
|
+
expect(listExclusionsSpy).toHaveBeenCalledWith(
|
|
276
|
+
"entityName",
|
|
277
|
+
{
|
|
278
|
+
page: 0,
|
|
279
|
+
size: 10,
|
|
280
|
+
sort: [],
|
|
281
|
+
filterQuery: filter,
|
|
282
|
+
displayFields: ["recordId", "description", "status", "startDate", "finishDate"]
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
it("should filter by start date and finish date", () => {
|
|
288
|
+
const listExclusionsSpy = mockDefaultListExclusionsCall();
|
|
289
|
+
fixture.detectChanges(false);
|
|
290
|
+
|
|
291
|
+
const startDate = new Date(2023, 2, 10);
|
|
292
|
+
const endDate = new Date(2023, 2, 15);
|
|
293
|
+
component.filterFormGroup.controls["startDate"].setValue(startDate);
|
|
294
|
+
component.filterFormGroup.controls["endDate"].setValue(endDate);
|
|
295
|
+
const filterButton = fixture.nativeElement.querySelector("#filter-button");
|
|
296
|
+
filterButton.dispatchEvent(new Event("click"));
|
|
297
|
+
expect(listExclusionsSpy).toHaveBeenCalledWith(
|
|
298
|
+
"entityName",
|
|
299
|
+
{
|
|
300
|
+
page: 0,
|
|
301
|
+
size: 10,
|
|
302
|
+
sort: [],
|
|
303
|
+
filterQuery: "startDate between '2023-03-10' and '2023-03-15'",
|
|
304
|
+
displayFields: ["recordId", "description", "status", "startDate", "finishDate"]
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
it("should clean all filters by pressing the Clear button", () => {
|
|
310
|
+
const listExclusionsSpy = mockDefaultListExclusionsCall();
|
|
311
|
+
fixture.detectChanges(false);
|
|
312
|
+
|
|
313
|
+
const testDate = new Date(2023, 2, 10);
|
|
314
|
+
component.filterFormGroup.controls["description"].setValue("test description");
|
|
315
|
+
component.filterFormGroup.controls["state"].setValue([EnumExclusionProcessStatus.PROCESSING]);
|
|
316
|
+
component.filterFormGroup.controls["startDate"].setValue(testDate);
|
|
317
|
+
component.filterFormGroup.controls["endDate"].setValue(testDate);
|
|
318
|
+
|
|
319
|
+
const clearFilterButton = fixture.nativeElement.querySelector("#clear-button");
|
|
320
|
+
clearFilterButton.dispatchEvent(new Event("click"));
|
|
321
|
+
expect(listExclusionsSpy).toHaveBeenCalledWith(
|
|
322
|
+
"entityName",
|
|
323
|
+
{
|
|
324
|
+
page: 0,
|
|
325
|
+
size: 10,
|
|
326
|
+
sort: [],
|
|
327
|
+
filterQuery: "",
|
|
328
|
+
displayFields: ["recordId", "description", "status", "startDate", "finishDate"]
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
|
|
332
|
+
for (const controlKey of Object.keys(component.filterFormGroup.controls)) {
|
|
333
|
+
expect(component.filterFormGroup.controls[controlKey].value).toBeFalsy();
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
describe("Table", () => {
|
|
339
|
+
it("should have all columns in the column confing with translation", () => {
|
|
340
|
+
mockDefaultListExclusionsCall();
|
|
341
|
+
fixture.detectChanges(false);
|
|
342
|
+
|
|
343
|
+
const columns = component.gridColumns;
|
|
344
|
+
const tableThs = Array.from(fixture.nativeElement.querySelectorAll("#exclusionsTable th") as any[]);
|
|
345
|
+
expect(tableThs.length).toBe(columns.length + 1); // Action column
|
|
346
|
+
|
|
347
|
+
for (const column of columns) {
|
|
348
|
+
const th = tableThs.find(p => p.id === column.field);
|
|
349
|
+
expect(th).toBeTruthy();
|
|
350
|
+
expect(th.textContent.trim()).toBe(column.header);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const actionColumn = tableThs[tableThs.length - 1];
|
|
354
|
+
expect(actionColumn.textContent.trim()).toBe("Ações");
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
it("should render the description column data", () => {
|
|
358
|
+
mockDefaultListExclusionsCall();
|
|
359
|
+
|
|
360
|
+
component.gridData = [{
|
|
361
|
+
id: "valid id",
|
|
362
|
+
recordId: "record id",
|
|
363
|
+
description: "Test description",
|
|
364
|
+
status: EnumExclusionProcessStatus.SUCCESS,
|
|
365
|
+
startDate: new Date(),
|
|
366
|
+
finishDate: new Date(),
|
|
367
|
+
entityName: "",
|
|
368
|
+
groups: []
|
|
369
|
+
}];
|
|
370
|
+
|
|
371
|
+
fixture.detectChanges(false);
|
|
372
|
+
|
|
373
|
+
const decriptionColumn = fixture.nativeElement.querySelectorAll("#exclusionsTable td")[0];
|
|
374
|
+
expect(decriptionColumn.textContent).toBe("Test description");
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
it("should render the status column for success", () => {
|
|
378
|
+
mockDefaultListExclusionsCall();
|
|
379
|
+
|
|
380
|
+
component.gridData = [{
|
|
381
|
+
id: "valid id",
|
|
382
|
+
recordId: "record id",
|
|
383
|
+
description: "Test description",
|
|
384
|
+
status: EnumExclusionProcessStatus.SUCCESS,
|
|
385
|
+
startDate: new Date(),
|
|
386
|
+
finishDate: new Date(),
|
|
387
|
+
entityName: "",
|
|
388
|
+
groups: []
|
|
389
|
+
}];
|
|
390
|
+
|
|
391
|
+
fixture.detectChanges(false);
|
|
392
|
+
|
|
393
|
+
const statusColumn = fixture.nativeElement.querySelectorAll("#exclusionsTable td")[1];
|
|
394
|
+
expect(statusColumn.textContent).toBe("domain.service.logical_delete_enum_exclusion_process_status_success");
|
|
395
|
+
const span = statusColumn.querySelectorAll("span")[0];
|
|
396
|
+
expect(span.className).toContain("sds-badge sds-semantic-green");
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
it("should render the status column for error", () => {
|
|
400
|
+
mockDefaultListExclusionsCall();
|
|
401
|
+
|
|
402
|
+
component.gridData = [{
|
|
403
|
+
id: "valid id",
|
|
404
|
+
recordId: "record id",
|
|
405
|
+
description: "Test description",
|
|
406
|
+
status: EnumExclusionProcessStatus.ERROR,
|
|
407
|
+
startDate: new Date(),
|
|
408
|
+
finishDate: new Date(),
|
|
409
|
+
entityName: "",
|
|
410
|
+
groups: []
|
|
411
|
+
}];
|
|
412
|
+
|
|
413
|
+
fixture.detectChanges(false);
|
|
414
|
+
|
|
415
|
+
const statusColumn = fixture.nativeElement.querySelectorAll("#exclusionsTable td")[1];
|
|
416
|
+
expect(statusColumn.textContent).toBe("domain.service.logical_delete_enum_exclusion_process_status_error");
|
|
417
|
+
const span = statusColumn.querySelectorAll("span")[0];
|
|
418
|
+
expect(span.className).toContain("sds-badge sds-semantic-red");
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
it("should render the status column for pending", () => {
|
|
422
|
+
mockDefaultListExclusionsCall();
|
|
423
|
+
|
|
424
|
+
component.gridData = [{
|
|
425
|
+
id: "valid id",
|
|
426
|
+
recordId: "record id",
|
|
427
|
+
description: "Test description",
|
|
428
|
+
status: EnumExclusionProcessStatus.PENDING,
|
|
429
|
+
startDate: new Date(),
|
|
430
|
+
finishDate: new Date(),
|
|
431
|
+
entityName: "",
|
|
432
|
+
groups: []
|
|
433
|
+
}];
|
|
434
|
+
|
|
435
|
+
fixture.detectChanges(false);
|
|
436
|
+
|
|
437
|
+
const statusColumn = fixture.nativeElement.querySelectorAll("#exclusionsTable td")[1];
|
|
438
|
+
expect(statusColumn.textContent).toBe("domain.service.logical_delete_enum_exclusion_process_status_pending");
|
|
439
|
+
const span = statusColumn.querySelectorAll("span")[0];
|
|
440
|
+
expect(span.className).toContain("sds-badge sds-semantic-yellow");
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
it("should render the status column for processing", () => {
|
|
444
|
+
mockDefaultListExclusionsCall();
|
|
445
|
+
|
|
446
|
+
component.gridData = [{
|
|
447
|
+
id: "valid id",
|
|
448
|
+
recordId: "record id",
|
|
449
|
+
description: "Test description",
|
|
450
|
+
status: EnumExclusionProcessStatus.PROCESSING,
|
|
451
|
+
startDate: new Date(),
|
|
452
|
+
finishDate: new Date(),
|
|
453
|
+
entityName: "",
|
|
454
|
+
groups: []
|
|
455
|
+
}];
|
|
456
|
+
|
|
457
|
+
fixture.detectChanges(false);
|
|
458
|
+
|
|
459
|
+
const statusColumn = fixture.nativeElement.querySelectorAll("#exclusionsTable td")[1];
|
|
460
|
+
expect(statusColumn.textContent).toBe("domain.service.logical_delete_enum_exclusion_process_status_processing");
|
|
461
|
+
const span = statusColumn.querySelectorAll("span")[0];
|
|
462
|
+
expect(span.className).toContain("sds-badge sds-semantic-blue");
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
it("should render the start date column with date format", () => {
|
|
466
|
+
mockDefaultListExclusionsCall();
|
|
467
|
+
|
|
468
|
+
component.gridData = [{
|
|
469
|
+
id: "valid id",
|
|
470
|
+
recordId: "record id",
|
|
471
|
+
description: "Test description",
|
|
472
|
+
status: EnumExclusionProcessStatus.PROCESSING,
|
|
473
|
+
startDate: new Date(2023, 2, 13, 15, 30),
|
|
474
|
+
finishDate: new Date(2023, 2, 14, 15, 30),
|
|
475
|
+
entityName: "",
|
|
476
|
+
groups: []
|
|
477
|
+
}];
|
|
478
|
+
|
|
479
|
+
fixture.detectChanges(false);
|
|
480
|
+
|
|
481
|
+
const statusColumn = fixture.nativeElement.querySelectorAll("#exclusionsTable td")[2];
|
|
482
|
+
expect(statusColumn.textContent).toBe("13/03/2023 15:30");
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
it("should render the end date column with date format", () => {
|
|
486
|
+
mockDefaultListExclusionsCall();
|
|
487
|
+
|
|
488
|
+
component.gridData = [{
|
|
489
|
+
id: "valid id",
|
|
490
|
+
recordId: "record id",
|
|
491
|
+
description: "Test description",
|
|
492
|
+
status: EnumExclusionProcessStatus.PROCESSING,
|
|
493
|
+
startDate: new Date(2023, 2, 13, 15, 30),
|
|
494
|
+
finishDate: new Date(2023, 2, 14, 8, 5),
|
|
495
|
+
entityName: "",
|
|
496
|
+
groups: []
|
|
497
|
+
}];
|
|
498
|
+
|
|
499
|
+
fixture.detectChanges(false);
|
|
500
|
+
|
|
501
|
+
const statusColumn = fixture.nativeElement.querySelectorAll("#exclusionsTable td")[3];
|
|
502
|
+
expect(statusColumn.textContent).toBe("14/03/2023 08:05");
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
it("should render the actions column", () => {
|
|
506
|
+
mockDefaultListExclusionsCall();
|
|
507
|
+
|
|
508
|
+
component.gridData = [{
|
|
509
|
+
id: "valid id",
|
|
510
|
+
recordId: "record id",
|
|
511
|
+
description: "Test description",
|
|
512
|
+
status: EnumExclusionProcessStatus.PROCESSING,
|
|
513
|
+
startDate: new Date(2023, 2, 13, 15, 30),
|
|
514
|
+
finishDate: new Date(2023, 2, 14, 8, 5),
|
|
515
|
+
entityName: "",
|
|
516
|
+
groups: []
|
|
517
|
+
}];
|
|
518
|
+
|
|
519
|
+
fixture.detectChanges(false);
|
|
520
|
+
|
|
521
|
+
const actionColumn = fixture.nativeElement.querySelectorAll("#exclusionsTable td")[4];
|
|
522
|
+
const button = actionColumn.querySelector("button");
|
|
523
|
+
expect(button.textContent).toBe(" domain.service.logical_delete_details ");
|
|
524
|
+
});
|
|
525
|
+
});
|
|
526
|
+
});
|