Skip to content

Commit cc72157

Browse files
author
Dave Syer
committed
Make tests run in Maven lifecycle
1 parent ed43fb1 commit cc72157

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@
7373
<arguments>run-script build</arguments>
7474
</configuration>
7575
</execution>
76+
<execution>
77+
<id>npm-test</id>
78+
<goals>
79+
<goal>npm</goal>
80+
</goals>
81+
<configuration>
82+
<arguments>run-script single-test</arguments>
83+
</configuration>
84+
<phase>test</phase>
85+
</execution>
7686
</executions>
7787
</plugin>
7888
</plugins>

src/main/client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"ng": "ng",
77
"start": "ng serve",
88
"build": "ng build",
9+
"single-test": "ng test --single-run",
910
"test": "ng test",
1011
"lint": "ng lint",
1112
"e2e": "ng e2e"
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { TestBed, async } from '@angular/core/testing';
22
import { AppComponent } from './app.component';
3+
import { HttpClientTestingModule } from '@angular/common/http/testing'
34
describe('AppComponent', () => {
45
beforeEach(async(() => {
56
TestBed.configureTestingModule({
7+
imports: [HttpClientTestingModule],
68
declarations: [
79
AppComponent
8-
],
10+
]
911
}).compileComponents();
1012
}));
1113
it('should create the app', async(() => {
@@ -16,12 +18,12 @@ describe('AppComponent', () => {
1618
it(`should have as title 'app'`, async(() => {
1719
const fixture = TestBed.createComponent(AppComponent);
1820
const app = fixture.debugElement.componentInstance;
19-
expect(app.title).toEqual('app');
21+
expect(app.title).toEqual('Demo');
2022
}));
2123
it('should render title in a h1 tag', async(() => {
2224
const fixture = TestBed.createComponent(AppComponent);
2325
fixture.detectChanges();
2426
const compiled = fixture.debugElement.nativeElement;
25-
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
27+
expect(compiled.querySelector('h1').textContent).toContain('Welcome Demo!');
2628
}));
2729
});

src/main/client/src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component } from '@angular/core';
2-
import {HttpClient} from '@angular/common/http';
2+
import { HttpClient } from '@angular/common/http';
33

44
@Component({
55
selector: 'app-root',

0 commit comments

Comments
 (0)