diff options
author | crupest <crupest@outlook.com> | 2019-02-21 23:36:41 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-02-21 23:36:41 +0800 |
commit | b694d7a3e1b04bb942e5ba8224762d706f98a371 (patch) | |
tree | ce0cd6249f2c09797bca65cfb9dbc81f6c334d2e /Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts | |
parent | 0ed96f534f75ebc2a7bdbec031a4674368d0420a (diff) | |
download | timeline-b694d7a3e1b04bb942e5ba8224762d706f98a371.tar.gz timeline-b694d7a3e1b04bb942e5ba8224762d706f98a371.tar.bz2 timeline-b694d7a3e1b04bb942e5ba8224762d706f98a371.zip |
Add unit test.
Diffstat (limited to 'Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts')
-rw-r--r-- | Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts b/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts index 0718b64b..619e9a6b 100644 --- a/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts +++ b/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts @@ -3,23 +3,23 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs'; import { switchMap, concatMap, map, toArray } from 'rxjs/operators'; -interface AzureDevOpsAccessInfo { +export interface AzureDevOpsAccessInfo { username: string; personalAccessToken: string; organization: string; project: string; } -interface WiqlWorkItemResult { +export interface WiqlWorkItemResult { id: number; url: string; } -interface WiqlResult { +export interface WiqlResult { workItems: WiqlWorkItemResult[]; } -interface WorkItemResult { +export interface WorkItemResult { id: number; fields: { [name: string]: any }; } @@ -36,8 +36,8 @@ export interface WorkItem { }) export class TodoListService { - private titleFieldName = 'System.Title'; - private stateFieldName = 'System.State'; + public static titleFieldName = 'System.Title'; + public static stateFieldName = 'System.State'; constructor(private client: HttpClient) { } @@ -61,8 +61,8 @@ export class TodoListService { concatMap(result => this.client.get<WorkItemResult>(result.url, { headers: headers })), map(result => <WorkItem>{ id: result.id, - title: <string>result.fields[this.titleFieldName], - closed: ((<string>result.fields[this.stateFieldName]).toLowerCase() === 'closed') + title: <string>result.fields[TodoListService.titleFieldName], + closed: ((<string>result.fields[TodoListService.stateFieldName]).toLowerCase() === 'closed') }), toArray() ); |