From b44bc9c022c808fe2e9c808d0395513c8e773ebd Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Mon, 6 Mar 2017 14:08:38 +0000 Subject: [PATCH] test(aio): add mock services --- aio/src/testing/location.service.ts | 8 ++++++++ aio/src/testing/logger.service.ts | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 aio/src/testing/location.service.ts create mode 100644 aio/src/testing/logger.service.ts diff --git a/aio/src/testing/location.service.ts b/aio/src/testing/location.service.ts new file mode 100644 index 0000000000..2d3ae9d64d --- /dev/null +++ b/aio/src/testing/location.service.ts @@ -0,0 +1,8 @@ +import { BehaviorSubject } from 'rxjs/BehaviorSubject'; + +export class MockLocationService { + urlSubject = new BehaviorSubject(this.initialUrl); + currentUrl = this.urlSubject.asObservable(); + constructor(private initialUrl) {} +} + diff --git a/aio/src/testing/logger.service.ts b/aio/src/testing/logger.service.ts new file mode 100644 index 0000000000..999526c402 --- /dev/null +++ b/aio/src/testing/logger.service.ts @@ -0,0 +1,23 @@ +import { Injectable } from '@angular/core'; + +@Injectable() +export class MockLogger { + + output = { + log: [], + error: [], + warn: [] + }; + + log(value: any, ...rest) { + this.output.log.push([value, ...rest]); + } + + error(value: any, ...rest) { + this.output.error.push([value, ...rest]); + } + + warn(value: any, ...rest) { + this.output.warn.push([value, ...rest]); + } +}