Skip to content

Commit

Permalink
Fixed file info dialog test
Browse files Browse the repository at this point in the history
  • Loading branch information
rdamazio committed Jun 1, 2024
1 parent ef4c7c7 commit 2d78e29
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/checklists/file-info/file-info.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ import { HarnessLoader } from '@angular/cdk/testing';
import { MAT_DIALOG_DATA, MatDialog, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { MatDialogHarness } from '@angular/material/dialog/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { ChecklistFileMetadata } from '../../../../gen/ts/checklist';
import { ChecklistFileInfoComponent } from './file-info.component';

describe('ChecklistFileInfoComponent', () => {
let fixture: ComponentFixture<ChecklistFileInfoComponent>;
let loader: HarnessLoader;
let dialog: MatDialog;
const DATA = {
metadata: ChecklistFileMetadata.create(),
allGroups: [],
};

beforeEach(async () => {
await TestBed.configureTestingModule({
Expand All @@ -20,7 +25,7 @@ describe('ChecklistFileInfoComponent', () => {
],
providers: [
{ provide: MatDialogRef, useValue: {} },
{ provide: MAT_DIALOG_DATA, useValue: {} },
{ provide: MAT_DIALOG_DATA, useValue: DATA },
],
}).compileComponents();

Expand All @@ -38,7 +43,7 @@ describe('ChecklistFileInfoComponent', () => {
});

it('should open and close the dialog', async () => {
dialog.open(ChecklistFileInfoComponent, { data: {} });
dialog.open(ChecklistFileInfoComponent, { data: DATA });

let dialogs = await loader.getAllHarnesses(MatDialogHarness);
expect(dialogs.length).toBe(1);
Expand Down

0 comments on commit 2d78e29

Please sign in to comment.