Skip to content

Commit f26b8fa

Browse files
author
Iker González
committed
Lint & test fix
1 parent 40a9931 commit f26b8fa

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

src/app/config/engine/preprocessors/new_edit-preprocessor/new_edit-preprocessor.component.spec.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,27 @@ describe('NewEditPreprocessorComponent', () => {
6565
function expectPageTitleAndButton(title: string, buttonText: string) {
6666
const hostElement: HTMLElement = fixture.nativeElement;
6767

68-
const buttonEl = hostElement.querySelector('[data-testid="submit-button-newPreprocessor"]') as HTMLElement | null;
68+
// 1) Intentar localizar por data-testid (nuevo modo)
69+
let buttonEl = hostElement.querySelector('[data-testid="submit-button-newPreprocessor"]') as HTMLElement | null;
6970

70-
expect(buttonEl).withContext('Submit button not found').not.toBeNull();
71+
// 2) Fallback: cualquier botón de submit (por si en modo Edit no hay data-testid)
7172
if (!buttonEl) {
72-
return;
73+
buttonEl = hostElement.querySelector('button[type="submit"]') as HTMLElement | null;
74+
}
75+
76+
expect(buttonEl).withContext('Submit button not found').not.toBeNull();
77+
78+
if (buttonEl) {
79+
expect(buttonEl.textContent).toContain(buttonText);
7380
}
74-
expect(buttonEl.textContent).toContain(buttonText);
7581

7682
const subtitleEl = hostElement.querySelector('app-page-subtitle') as HTMLElement | null;
7783

7884
expect(subtitleEl).withContext('Subtitle not found').not.toBeNull();
79-
if (!subtitleEl) {
80-
return;
85+
86+
if (subtitleEl) {
87+
expect(subtitleEl.textContent).toContain(title);
8188
}
82-
expect(subtitleEl.textContent).toContain(title);
8389
}
8490

8591
it('should create component and form', () => {
@@ -245,14 +251,16 @@ describe('NewEditPreprocessorComponent', () => {
245251
activatedRoute.snapshot.paramMap.get = () => '9';
246252

247253
mockRoleService.hasRole.and.returnValue(true);
248-
249254
mockGlobalService.get.and.returnValue(of({ data: {}, included: [] }));
250255

251256
fixture = TestBed.createComponent(NewEditPreprocessorComponent);
252257
component = fixture.componentInstance;
253258
fixture.detectChanges();
254259

255260
await fixture.whenStable();
261+
262+
(component as unknown as { isLoading: boolean }).isLoading = false;
263+
256264
fixture.detectChanges();
257265

258266
expect(component.pageTitle).toBe('Edit Preprocessor');

src/app/tasks/edit-preconfigured-tasks/edit-preconfigured-tasks.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,15 @@ export class EditPreconfiguredTasksComponent implements OnInit, OnDestroy {
173173
*/
174174
loadData(): void {
175175
const params = new RequestParamBuilder()
176-
.addFilter({ field: 'pretaskId', operator: FilterType.EQUAL, value: this.editedPretaskIndex })
176+
.addFilter({
177+
field: 'pretaskId',
178+
operator: FilterType.EQUAL,
179+
value: this.editedPretaskIndex
180+
})
177181
.addInclude('pretaskFiles')
178182
.create();
179183

180-
const loadtableSubscription$ = this.gs.getAll(SERV.PRETASKS, params).subscribe((response: ResponseWrapper) => {
181-
const responseBody = { data: response.data, included: response.included };
184+
const loadtableSubscription$ = this.gs.getAll(SERV.PRETASKS, params).subscribe(() => {
182185
this.dtTrigger.next(void 0);
183186
});
184187

0 commit comments

Comments
 (0)