Skip to content

Commit b44bc9c

Browse files
petebacondarwinIgorMinar
authored andcommitted
test(aio): add mock services
1 parent b7e76cc commit b44bc9c

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
2+
3+
export class MockLocationService {
4+
urlSubject = new BehaviorSubject<string>(this.initialUrl);
5+
currentUrl = this.urlSubject.asObservable();
6+
constructor(private initialUrl) {}
7+
}
8+

aio/src/testing/logger.service.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Injectable } from '@angular/core';
2+
3+
@Injectable()
4+
export class MockLogger {
5+
6+
output = {
7+
log: [],
8+
error: [],
9+
warn: []
10+
};
11+
12+
log(value: any, ...rest) {
13+
this.output.log.push([value, ...rest]);
14+
}
15+
16+
error(value: any, ...rest) {
17+
this.output.error.push([value, ...rest]);
18+
}
19+
20+
warn(value: any, ...rest) {
21+
this.output.warn.push([value, ...rest]);
22+
}
23+
}

0 commit comments

Comments
 (0)