Skip to content

Commit

Permalink
fix tests of complete dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Nov 4, 2024
1 parent b9ab36f commit 76a6f30
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';

import { CompleteDialogComponent } from './complete-dialog.component';
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { DialogHeaderComponent } from '../../custom/dialog-header/dialog-header.component';
import { TranslateService } from '@ngx-translate/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatIconModule } from '@angular/material/icon';
import { DialogTemplateCoreComponent } from '../../custom/dialog-template-core/dialog-template-core.component';
import { MatDividerModule } from '@angular/material/divider';
import { provideRouter } from '@angular/router';
import { provideHttpClient } from '@angular/common/http';
import { provideHttpClientTesting } from '@angular/common/http/testing';

const dialogMock = {
close: jest.fn(),
Expand All @@ -24,9 +28,12 @@ describe('CompleteDialogComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [FormsModule, ReactiveFormsModule, MatDialogModule, MatIconModule],
declarations: [CompleteDialogComponent, DialogHeaderComponent],
imports: [FormsModule, ReactiveFormsModule, MatDialogModule, MatIconModule, MatDividerModule],
declarations: [CompleteDialogComponent, DialogTemplateCoreComponent],
providers: [
provideRouter([]),
provideHttpClient(),
provideHttpClientTesting(),
{ provide: MatDialogRef, useValue: dialogMock },
{ provide: MAT_DIALOG_DATA, useValue: matDataMock },
{ provide: TranslateService, useValue: {} },
Expand All @@ -45,7 +52,7 @@ describe('CompleteDialogComponent', () => {
let elements = document.querySelectorAll('.valuation-card');
let successful = document.querySelectorAll('.card-hover-successful');
let notSuccessful = document.querySelectorAll('.card-hover-not-successful');
let submitButton = document.querySelectorAll('button')[1];
let submitButton = document.querySelectorAll('button')[0];

expect(elements.length).toEqual(2);
expect(successful.length).toEqual(1);
Expand Down

0 comments on commit 76a6f30

Please sign in to comment.