Skip to content

Commit

Permalink
Fixed test dependencies (#399)
Browse files Browse the repository at this point in the history
* fixed test dependencies

* Wrapped list item for testing

* allowed testing independent of build
  • Loading branch information
therealryan authored Jun 1, 2023
1 parent 3927656 commit 304f648
Show file tree
Hide file tree
Showing 32 changed files with 601 additions and 90 deletions.
46 changes: 46 additions & 0 deletions report/report-ng/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,32 @@ Build with
<arguments>run build-all</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>node-local-test</id>
<activation>
<property>
<name>node</name>
<value>local</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<!-- Step 1: compile the angular projects into the dist directory -->
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<configuration>
<nodeVersion>v14.15.1</nodeVersion>
<yarnVersion>v1.22.17</yarnVersion>
<installDirectory>${user.home}/.node</installDirectory>
</configuration>
<executions>
<execution>
<id>yarn run test</id>
<goals>
Expand Down Expand Up @@ -239,6 +265,26 @@ Build with
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>node-system-test</id>
<activation>
<property>
<name>node</name>
<value>system</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>yarn run test</id>
<goals>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { Component, Input } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ChangeAnalysisComponent } from './change-analysis.component';
import { FlowDiffService } from '../flow-diff.service';
import { ModelDiffDataService } from '../model-diff-data.service';
import { RouterTestingModule } from '@angular/router/testing';
import { Entry } from '../types';
import { MatExpansionModule } from '@angular/material/expansion';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { PortalModule } from '@angular/cdk/portal';

describe('ChangeAnalysisComponent', () => {
let component: ChangeAnalysisComponent;
Expand All @@ -17,12 +21,21 @@ describe('ChangeAnalysisComponent', () => {
mockFds.collated = [];
mockMdds = jasmine.createSpyObj(['index', 'onIndex']);
await TestBed.configureTestingModule({
declarations: [ChangeAnalysisComponent],
declarations: [
ChangeAnalysisComponent,

StubFlowNavList,
],
providers: [
{ provide: FlowDiffService, useValue: mockFds },
{ provide: ModelDiffDataService, useValue: mockMdds },
],
imports: [RouterTestingModule]
imports: [
RouterTestingModule,
BrowserAnimationsModule,
PortalModule,
MatExpansionModule,
]
})
.compileComponents();
});
Expand All @@ -34,7 +47,17 @@ describe('ChangeAnalysisComponent', () => {
});

it('should create', () => {
// Need to mock/inject a bunch of stuff
// expect(component).toBeTruthy();
expect(component).toBeTruthy();
});
});

@Component({
selector: 'app-flow-nav-list',
template: ''
})
class StubFlowNavList {
@Input() basePath: string = "";
@Input() showResult: boolean = true;
@Input() draggable: boolean = false;
@Input() entries: Entry[] = [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Entry, removeResultTagsFrom } from '../types';
@Component({
selector: 'app-change-analysis',
templateUrl: './change-analysis.component.html',
styleUrls: ['./change-analysis.component.css']
styleUrls: ['./change-analysis.component.css'],
})
export class ChangeAnalysisComponent implements OnInit {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import { ChangeViewComponent } from './change-view.component';
import { FlowDiffService } from '../flow-diff.service';
import { ModelDiffDataService } from '../model-diff-data.service';
import { FlowFilterService } from '../flow-filter.service';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatRippleModule } from '@angular/material/core';
import { MatListModule } from '@angular/material/list';
import { FormsModule } from '@angular/forms';
import { MatSidenavModule } from '@angular/material/sidenav';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatIconModule } from '@angular/material/icon';
import { MatDividerModule } from '@angular/material/divider';

describe('ChangeViewComponent', () => {
let component: ChangeViewComponent;
Expand All @@ -17,13 +25,25 @@ describe('ChangeViewComponent', () => {
mockMdds = jasmine.createSpyObj(['index']);
mockFilter = jasmine.createSpyObj(['onUpdate', 'passes', 'isEmpty'])
await TestBed.configureTestingModule({
declarations: [ChangeViewComponent],
declarations: [
ChangeViewComponent,
],
providers: [
{ provide: FlowDiffService, useValue: mockFds },
{ provide: ModelDiffDataService, useValue: mockMdds },
{ provide: FlowFilterService, useValue: mockFilter },
],
imports: [RouterTestingModule]
imports: [
RouterTestingModule,
MatRippleModule,
MatButtonToggleModule,
FormsModule,
BrowserAnimationsModule,
MatListModule,
MatIconModule,
MatDividerModule,
MatSidenavModule,
]
})
.compileComponents();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ContextViewComponent } from './context-view.component';
import { MatExpansionModule } from '@angular/material/expansion';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ContextViewComponent ]
declarations: [
ContextViewComponent
],
imports: [
MatExpansionModule,
],
})
.compileComponents();
.compileComponents();
});

beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { Component, Input } from '@angular/core';
import { DetailComponent } from './detail.component';
import { BasisFetchService } from '../basis-fetch.service';
import { MatMenu } from '@angular/material/menu';
import { MatMenuModule } from '@angular/material/menu';
import { MatListModule } from '@angular/material/list';
import { DiffType, Display, LogEvent, Options } from '../types';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatTabsModule } from '@angular/material/tabs';
import { MatIconModule } from '@angular/material/icon';
import { MatToolbarModule } from '@angular/material/toolbar';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { DiffTableFormat } from 'ngx-text-diff/lib/ngx-text-diff.model';
import { SequenceData } from '../flow-sequence/flow-sequence.component';

describe('DetailComponent', () => {
let component: DetailComponent;
Expand All @@ -12,10 +21,27 @@ describe('DetailComponent', () => {
beforeEach(async () => {
mockBasisFetch = jasmine.createSpyObj(['get']);
await TestBed.configureTestingModule({
declarations: [DetailComponent, MatMenu],
declarations: [
DetailComponent,

StubLogView,
StubFlowSequence,
StubTransmission,
StubMarkdown,
StubViewOptions,
],
providers: [
{ provide: BasisFetchService, useValue: mockBasisFetch },
],
imports: [
MatMenuModule,
BrowserAnimationsModule,
MatSidenavModule,
MatIconModule,
MatListModule,
MatTabsModule,
MatToolbarModule,
],
})
.compileComponents();
});
Expand All @@ -30,3 +56,45 @@ describe('DetailComponent', () => {
expect(component).toBeTruthy();
});
});

@Component({
selector: 'app-log-view',
template: ''
})
class StubLogView {
@Input() logs: LogEvent[] = [];
}

@Component({
selector: 'app-flow-sequence',
template: ''
})
class StubFlowSequence {
@Input() sequence: SequenceData = { entity: [], item: [] };
}

@Component({
selector: 'app-view-options',
template: ''
})
class StubViewOptions {
@Input() options: Options = new Options();
}

@Component({
selector: 'app-transmission',
template: ''
})
class StubTransmission {
@Input() options: Options = new Options();
@Input() display: Display = Display.Actual;
@Input() diffType: DiffType = DiffType.Asserted;
@Input() diffFormat: DiffTableFormat = 'LineByLine';
}

@Component({
selector: 'markdown',
template: ''
})
class StubMarkdown {
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,40 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { Component, Input } from '@angular/core';
import { FlowFilterComponent } from './flow-filter.component';
import { RouterTestingModule } from '@angular/router/testing';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { Type } from '../flow-filter.service';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatExpansionModule, MatExpansionPanel, MatExpansionPanelDescription, MatExpansionPanelHeader, MatExpansionPanelTitle } from '@angular/material/expansion';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
import { MatRippleModule } from '@angular/material/core';
import { MatButtonModule } from '@angular/material/button';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [FlowFilterComponent],
imports: [RouterTestingModule]
declarations: [
FlowFilterComponent,
StubTagFilter,
],
imports: [
RouterTestingModule,
BrowserAnimationsModule,
FormsModule,
MatRippleModule,
MatExpansionModule,
MatInputModule,
MatFormFieldModule,
MatButtonModule,
MatButtonToggleModule,
MatIconModule,
]
})
.compileComponents();
});
Expand All @@ -25,3 +49,14 @@ describe('FlowFilterComponent', () => {
expect(component).toBeTruthy();
});
});


@Component({
selector: 'app-tag-filter',
template: ''
})
class StubTagFilter {
@Input() type: Type = Type.Include;
@Input() tags: Set<string> = new Set();
@Input() disabled: boolean = false;
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { FlowNavItemComponent } from './flow-nav-item.component';
import { MatListModule } from '@angular/material/list';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [FlowNavItemComponent]
declarations: [
FlowNavItemComponent,
],
imports: [
MatListModule,
],
})
.compileComponents();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { FlowNavListComponent } from './flow-nav-list.component';
import { MatListModule } from '@angular/material/list';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [FlowNavListComponent]
declarations: [
FlowNavListComponent,
],
imports: [
MatListModule,
],
})
.compileComponents();
});
Expand Down
Loading

0 comments on commit 304f648

Please sign in to comment.