diff options
author | crupest <crupest@outlook.com> | 2019-03-11 00:07:59 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-03-11 00:07:59 +0800 |
commit | f8cfca136a69c6589bb610a66ea5342fc585f19b (patch) | |
tree | a14bfc3d1d12e6852c0f383142b0a78a2f98a180 /Timeline/ClientApp/src/app/user/mock-activated-route.ts | |
parent | 233de3a11027fd88130882f20764ee5f2952abe0 (diff) | |
download | timeline-f8cfca136a69c6589bb610a66ea5342fc585f19b.tar.gz timeline-f8cfca136a69c6589bb610a66ea5342fc585f19b.tar.bz2 timeline-f8cfca136a69c6589bb610a66ea5342fc585f19b.zip |
Write unit tests.
Diffstat (limited to 'Timeline/ClientApp/src/app/user/mock-activated-route.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/user/mock-activated-route.ts | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/Timeline/ClientApp/src/app/user/mock-activated-route.ts b/Timeline/ClientApp/src/app/user/mock-activated-route.ts deleted file mode 100644 index 9e516e83..00000000 --- a/Timeline/ClientApp/src/app/user/mock-activated-route.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { ParamMap } from '@angular/router'; - -interface MockActivatedRoute { - snapshot: MockActivatedRouteSnapshot; -} - -interface MockActivatedRouteSnapshot { - paramMap: ParamMap; -} - -export function createMockActivatedRoute(mockParamMap: { [name: string]: string | string[] }): MockActivatedRoute { - return { - snapshot: { - paramMap: { - keys: Object.keys(mockParamMap), - get(name: string): string | null { - const param = mockParamMap[name]; - if (typeof param === 'string') { - return param; - } else if (param instanceof Array) { - if (param.length === 0) { - return null; - } - return param[0]; - } - return null; - }, - getAll(name: string): string[] { - const param = mockParamMap[name]; - if (typeof param === 'string') { - return [param]; - } else if (param instanceof Array) { - return param; - } - return []; - }, - has(name: string): boolean { - return mockParamMap.hasOwnProperty(name); - } - } - } - } -} |