Skip to content

Commit 6b20923

Browse files
committed
added coverage to sidebar
1 parent aca0054 commit 6b20923

File tree

6 files changed

+208
-125
lines changed

6 files changed

+208
-125
lines changed

angular.json

Lines changed: 123 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +1,130 @@
11
{
2-
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3-
"version": 1,
4-
"newProjectRoot": "projects",
5-
"projects": {
6-
"time-tracker": {
7-
"projectType": "application",
8-
"schematics": {},
9-
"root": "",
10-
"sourceRoot": "src",
11-
"prefix": "app",
12-
"architect": {
13-
"build": {
14-
"builder": "@angular-devkit/build-angular:browser",
15-
"options": {
16-
"outputPath": "dist/time-tracker",
17-
"index": "src/index.html",
18-
"main": "src/main.ts",
19-
"polyfills": "src/polyfills.ts",
20-
"tsConfig": "tsconfig.app.json",
21-
"aot": true,
22-
"assets": [
23-
"src/favicon.ico",
24-
"src/assets"
25-
],
26-
"styles": [
27-
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
28-
"src/styles.css"
29-
],
30-
"scripts": [
31-
"./node_modules/jquery/dist/jquery.min.js",
32-
"./node_modules/bootstrap/dist/js/bootstrap.min.js"
33-
]
34-
},
35-
"configurations": {
36-
"production": {
37-
"fileReplacements": [
38-
{
39-
"replace": "src/environments/environment.ts",
40-
"with": "src/environments/environment.prod.ts"
41-
}
42-
],
43-
"optimization": true,
44-
"outputHashing": "all",
45-
"sourceMap": false,
46-
"extractCss": true,
47-
"namedChunks": false,
48-
"extractLicenses": true,
49-
"vendorChunk": false,
50-
"buildOptimizer": true,
51-
"budgets": [
52-
{
53-
"type": "initial",
54-
"maximumWarning": "2mb",
55-
"maximumError": "5mb"
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"time-tracker": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
"outputPath": "dist/time-tracker",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": "src/polyfills.ts",
20+
"tsConfig": "tsconfig.app.json",
21+
"aot": true,
22+
"assets": [
23+
"src/favicon.ico",
24+
"src/assets"
25+
],
26+
"styles": [
27+
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
28+
"src/styles.css"
29+
],
30+
"scripts": [
31+
"./node_modules/jquery/dist/jquery.min.js",
32+
"./node_modules/bootstrap/dist/js/bootstrap.min.js"
33+
]
34+
},
35+
"configurations": {
36+
"production": {
37+
"fileReplacements": [{
38+
"replace": "src/environments/environment.ts",
39+
"with": "src/environments/environment.prod.ts"
40+
}],
41+
"optimization": true,
42+
"outputHashing": "all",
43+
"sourceMap": false,
44+
"extractCss": true,
45+
"namedChunks": false,
46+
"extractLicenses": true,
47+
"vendorChunk": false,
48+
"buildOptimizer": true,
49+
"budgets": [{
50+
"type": "initial",
51+
"maximumWarning": "2mb",
52+
"maximumError": "5mb"
53+
},
54+
{
55+
"type": "anyComponentStyle",
56+
"maximumWarning": "6kb",
57+
"maximumError": "10kb"
58+
}
59+
]
60+
}
61+
}
62+
},
63+
"serve": {
64+
"builder": "@angular-devkit/build-angular:dev-server",
65+
"options": {
66+
"browserTarget": "time-tracker:build"
67+
},
68+
"configurations": {
69+
"production": {
70+
"browserTarget": "time-tracker:build:production"
71+
}
72+
}
73+
},
74+
"extract-i18n": {
75+
"builder": "@angular-devkit/build-angular:extract-i18n",
76+
"options": {
77+
"browserTarget": "time-tracker:build"
78+
}
79+
},
80+
"test": {
81+
"builder": "@angular-devkit/build-angular:karma",
82+
"options": {
83+
"main": "src/test.ts",
84+
"polyfills": "src/polyfills.ts",
85+
"tsConfig": "tsconfig.spec.json",
86+
"karmaConfig": "karma.conf.js",
87+
"codeCoverage": true,
88+
"assets": [
89+
"src/favicon.ico",
90+
"src/assets"
91+
],
92+
"styles": [
93+
"src/styles.css"
94+
],
95+
"scripts": []
96+
}
5697
},
57-
{
58-
"type": "anyComponentStyle",
59-
"maximumWarning": "6kb",
60-
"maximumError": "10kb"
98+
"lint": {
99+
"builder": "@angular-devkit/build-angular:tslint",
100+
"options": {
101+
"tsConfig": [
102+
"tsconfig.app.json",
103+
"tsconfig.spec.json",
104+
"e2e/tsconfig.json"
105+
],
106+
"exclude": [
107+
"**/node_modules/**"
108+
]
109+
}
110+
},
111+
"e2e": {
112+
"builder": "@angular-devkit/build-angular:protractor",
113+
"options": {
114+
"protractorConfig": "e2e/protractor.conf.js",
115+
"devServerTarget": "time-tracker:serve"
116+
},
117+
"configurations": {
118+
"production": {
119+
"devServerTarget": "time-tracker:serve:production"
120+
}
121+
}
61122
}
62-
]
63-
}
64-
}
65-
},
66-
"serve": {
67-
"builder": "@angular-devkit/build-angular:dev-server",
68-
"options": {
69-
"browserTarget": "time-tracker:build"
70-
},
71-
"configurations": {
72-
"production": {
73-
"browserTarget": "time-tracker:build:production"
74-
}
75-
}
76-
},
77-
"extract-i18n": {
78-
"builder": "@angular-devkit/build-angular:extract-i18n",
79-
"options": {
80-
"browserTarget": "time-tracker:build"
81-
}
82-
},
83-
"test": {
84-
"builder": "@angular-devkit/build-angular:karma",
85-
"options": {
86-
"main": "src/test.ts",
87-
"polyfills": "src/polyfills.ts",
88-
"tsConfig": "tsconfig.spec.json",
89-
"karmaConfig": "karma.conf.js",
90-
"assets": [
91-
"src/favicon.ico",
92-
"src/assets"
93-
],
94-
"styles": [
95-
"src/styles.css"
96-
],
97-
"scripts": []
98-
}
99-
},
100-
"lint": {
101-
"builder": "@angular-devkit/build-angular:tslint",
102-
"options": {
103-
"tsConfig": [
104-
"tsconfig.app.json",
105-
"tsconfig.spec.json",
106-
"e2e/tsconfig.json"
107-
],
108-
"exclude": [
109-
"**/node_modules/**"
110-
]
111-
}
112-
},
113-
"e2e": {
114-
"builder": "@angular-devkit/build-angular:protractor",
115-
"options": {
116-
"protractorConfig": "e2e/protractor.conf.js",
117-
"devServerTarget": "time-tracker:serve"
118-
},
119-
"configurations": {
120-
"production": {
121-
"devServerTarget": "time-tracker:serve:production"
122123
}
123-
}
124124
}
125-
}
125+
},
126+
"defaultProject": "time-tracker",
127+
"cli": {
128+
"analytics": false
126129
}
127-
},
128-
"defaultProject": "time-tracker",
129-
"cli": {
130-
"analytics": false
131-
}
132130
}

src/app/components/options-sidebar/getting-started/getting-started.component.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ describe('GettingStartedComponent', () => {
66
let component: GettingStartedComponent;
77
let fixture: ComponentFixture<GettingStartedComponent>;
88

9+
function setup() {
10+
// tslint:disable-next-line: no-shadowed-variable
11+
const fixture = TestBed.createComponent(GettingStartedComponent);
12+
const app = fixture.debugElement.componentInstance;
13+
return { fixture, app };
14+
}
15+
916
beforeEach(async(() => {
1017
TestBed.configureTestingModule({
1118
declarations: [ GettingStartedComponent ]
@@ -22,4 +29,15 @@ describe('GettingStartedComponent', () => {
2229
it('should be created', () => {
2330
expect(component).toBeTruthy();
2431
});
32+
33+
it('should have p tag as \'getting-started works!\'', async(() => {
34+
// tslint:disable-next-line: no-shadowed-variable
35+
const { app, fixture } = setup();
36+
fixture.detectChanges();
37+
const compile = fixture.debugElement.nativeElement;
38+
const h1tag = compile.querySelector('p');
39+
expect(h1tag.textContent).toBe('getting-started works!');
40+
}));
41+
42+
2543
});

src/app/components/options-sidebar/reports/reports.component.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ describe('ReportsComponent', () => {
66
let component: ReportsComponent;
77
let fixture: ComponentFixture<ReportsComponent>;
88

9+
function setup() {
10+
// tslint:disable-next-line: no-shadowed-variable
11+
const fixture = TestBed.createComponent(ReportsComponent);
12+
const app = fixture.debugElement.componentInstance;
13+
return { fixture, app };
14+
}
15+
916
beforeEach(async(() => {
1017
TestBed.configureTestingModule({
1118
declarations: [ ReportsComponent ]
@@ -22,4 +29,14 @@ describe('ReportsComponent', () => {
2229
it('should be created', () => {
2330
expect(component).toBeTruthy();
2431
});
32+
33+
it('should have p tag as \'reports works!\'', async(() => {
34+
// tslint:disable-next-line: no-shadowed-variable
35+
const { app, fixture } = setup();
36+
fixture.detectChanges();
37+
const compile = fixture.debugElement.nativeElement;
38+
const h1tag = compile.querySelector('p');
39+
expect(h1tag.textContent).toBe('reports works!');
40+
}));
41+
2542
});

src/app/components/options-sidebar/time-clock/time-clock.component.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ describe('TimeClockComponent', () => {
66
let component: TimeClockComponent;
77
let fixture: ComponentFixture<TimeClockComponent>;
88

9+
function setup() {
10+
// tslint:disable-next-line: no-shadowed-variable
11+
const fixture = TestBed.createComponent(TimeClockComponent);
12+
const app = fixture.debugElement.componentInstance;
13+
return { fixture, app };
14+
}
15+
916
beforeEach(async(() => {
1017
TestBed.configureTestingModule({
1118
declarations: [ TimeClockComponent ]
@@ -22,4 +29,14 @@ describe('TimeClockComponent', () => {
2229
it('should be created', () => {
2330
expect(component).toBeTruthy();
2431
});
32+
33+
it('should have p tag as \'time-clock works!\'', async(() => {
34+
// tslint:disable-next-line: no-shadowed-variable
35+
const { app, fixture } = setup();
36+
fixture.detectChanges();
37+
const compile = fixture.debugElement.nativeElement;
38+
const h1tag = compile.querySelector('p');
39+
expect(h1tag.textContent).toBe('time-clock works!');
40+
}));
41+
2542
});

src/app/components/options-sidebar/time-entries/time-entries.component.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ describe('TimeEntriesComponent', () => {
66
let component: TimeEntriesComponent;
77
let fixture: ComponentFixture<TimeEntriesComponent>;
88

9+
function setup() {
10+
// tslint:disable-next-line: no-shadowed-variable
11+
const fixture = TestBed.createComponent(TimeEntriesComponent);
12+
const app = fixture.debugElement.componentInstance;
13+
return { fixture, app };
14+
}
15+
916
beforeEach(async(() => {
1017
TestBed.configureTestingModule({
1118
declarations: [ TimeEntriesComponent ]
@@ -22,4 +29,14 @@ describe('TimeEntriesComponent', () => {
2229
it('should be created', () => {
2330
expect(component).toBeTruthy();
2431
});
32+
33+
it('should have p tag as \'time-entries works!\'', async(() => {
34+
// tslint:disable-next-line: no-shadowed-variable
35+
const { app, fixture } = setup();
36+
fixture.detectChanges();
37+
const compile = fixture.debugElement.nativeElement;
38+
const h1tag = compile.querySelector('p');
39+
expect(h1tag.textContent).toBe('time-entries works!');
40+
}));
41+
2542
});

0 commit comments

Comments
 (0)