Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
clemiller committed Jul 10, 2024
1 parent 8d225e3 commit f57c059
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 6 deletions.
3 changes: 2 additions & 1 deletion nav-app/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import { TabsComponent } from './tabs/tabs.component';
import { MatDialogModule } from '@angular/material/dialog';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { ConfigService } from './services/config.service';
import { MatTabsModule } from '@angular/material/tabs';

describe('AppComponent', () => {
let fixture: ComponentFixture<AppComponent>;
let app: any;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, MatDialogModule, MatSnackBarModule],
imports: [HttpClientTestingModule, MatDialogModule, MatSnackBarModule, MatTabsModule],
declarations: [AppComponent, TabsComponent],
}).compileComponents();

Expand Down
3 changes: 2 additions & 1 deletion nav-app/src/app/help/help.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { HttpClientModule, HttpClient } from '@angular/common/http';
import { MarkdownService, MarkdownModule } from 'ngx-markdown';
import { Renderer2 } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { LayerInformationComponent } from '../layer-information/layer-information.component';

describe('HelpComponent', () => {
let component: HelpComponent;
Expand All @@ -17,7 +18,7 @@ describe('HelpComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientModule, MatDialogModule, MarkdownModule.forRoot({ loader: HttpClient }), BrowserAnimationsModule],
declarations: [HelpComponent],
declarations: [HelpComponent, LayerInformationComponent],
providers: [
{
provide: MatDialogRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LayerInformationComponent } from './layer-information.component';
import { MatDialogModule } from '@angular/material/dialog';
import { MarkdownModule, MarkdownService } from 'ngx-markdown';
import { HttpClient, HttpClientModule } from '@angular/common/http';

describe('LayerInformationComponent', () => {
let component: LayerInformationComponent;
let fixture: ComponentFixture<LayerInformationComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HttpClientModule, MatDialogModule, MarkdownModule.forRoot({ loader: HttpClient })],
declarations: [LayerInformationComponent],
providers: [MarkdownService]
}).compileComponents();
});

Expand Down
24 changes: 24 additions & 0 deletions nav-app/src/app/list-input/list-input.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,35 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ListInputComponent } from './list-input.component';
import { Link, Metadata, ViewModel } from '../classes';
import * as MockData from '../../tests/utils/mock-data';
import { CommonModule, NgForOf } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatIconModule } from '@angular/material/icon';
import { MatDividerModule } from '@angular/material/divider';
import { MatTooltipModule } from '@angular/material/tooltip';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

describe('ListInputComponent', () => {
let component: ListInputComponent;
let fixture: ComponentFixture<ListInputComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
CommonModule,
FormsModule,
MatFormFieldModule,
MatInputModule,
MatIconModule,
MatDividerModule,
MatTooltipModule,
BrowserAnimationsModule
],
declarations: [ListInputComponent],
}).compileComponents()
});

beforeEach(() => {
fixture = TestBed.createComponent(ListInputComponent);
component = fixture.debugElement.componentInstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { TechniqueVM, ViewModel } from '../../classes';
import { Tactic, Technique } from '../../classes/stix';
import { TacticCellComponent } from './tactic-cell.component';
import * as MockData from '../../../tests/utils/mock-data';
import { MatTooltipModule } from '@angular/material/tooltip';

describe('TacticCellComponent', () => {
let component: TacticCellComponent;
let fixture: ComponentFixture<TacticCellComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatTooltipModule],
declarations: [TacticCellComponent],
}).compileComponents();
}));
Expand Down
7 changes: 3 additions & 4 deletions nav-app/src/app/tabs/tabs.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Technique } from '../classes/stix';
import { ConfigService } from '../services/config.service';
import * as MockLayers from '../../tests/utils/mock-layers';
import * as MockData from '../../tests/utils/mock-data';
import { MatTabNavPanel, MatTabsModule } from '@angular/material/tabs';

describe('TabsComponent', () => {
let component: TabsComponent;
Expand All @@ -34,7 +35,7 @@ describe('TabsComponent', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, MatDialogModule],
imports: [HttpClientTestingModule, MatDialogModule, MatTabsModule, MatTabNavPanel],
providers: [DataService, { provide: MatSnackBar, useValue: {} }],
}).compileComponents();
dialog = TestBed.inject(MatDialog);
Expand Down Expand Up @@ -429,9 +430,7 @@ describe('TabsComponent', () => {

// layer dialog
component.openDialog('layers');
expect(openDialogSpy).toHaveBeenCalledWith(LayerInformationComponent, {
maxWidth: '90ch',
});
expect(openDialogSpy).toHaveBeenCalledWith(LayerInformationComponent, settings);

// help dialog
component.openDialog('help');
Expand Down

0 comments on commit f57c059

Please sign in to comment.