@@ -3,11 +3,12 @@ import { handleResponse, authHeader } from "../_helpers/service.helpers";
33import { API_URL } from "../_config/api.config" ;
44import { IgnoreArea } from "../types/ignoreArea" ;
55
6- const ENDPOINT_URL = "/test-runs"
6+ const ENDPOINT_URL = "/test-runs" ;
77
88export const testRunService = {
99 getList,
1010 remove,
11+ recalculateDiff,
1112 approve,
1213 reject,
1314 setIgnoreAreas,
@@ -19,7 +20,10 @@ function getList(buildId: string): Promise<TestRun[]> {
1920 headers : authHeader ( ) ,
2021 } ;
2122
22- return fetch ( `${ API_URL } ${ ENDPOINT_URL } ?buildId=${ buildId } ` , requestOptions ) . then ( handleResponse ) ;
23+ return fetch (
24+ `${ API_URL } ${ ENDPOINT_URL } ?buildId=${ buildId } ` ,
25+ requestOptions
26+ ) . then ( handleResponse ) ;
2327}
2428
2529function remove ( id : string ) : Promise < Number > {
@@ -28,7 +32,21 @@ function remove(id: string): Promise<Number> {
2832 headers : authHeader ( ) ,
2933 } ;
3034
31- return fetch ( `${ API_URL } ${ ENDPOINT_URL } /${ id } ` , requestOptions ) . then ( handleResponse ) ;
35+ return fetch ( `${ API_URL } ${ ENDPOINT_URL } /${ id } ` , requestOptions ) . then (
36+ handleResponse
37+ ) ;
38+ }
39+
40+ function recalculateDiff ( id : string ) : Promise < TestRun > {
41+ const requestOptions = {
42+ method : "GET" ,
43+ headers : authHeader ( ) ,
44+ } ;
45+
46+ return fetch (
47+ `${ API_URL } ${ ENDPOINT_URL } /recalculateDiff/${ id } ` ,
48+ requestOptions
49+ ) . then ( handleResponse ) ;
3250}
3351
3452function approve ( id : string ) : Promise < TestRun > {
@@ -67,4 +85,4 @@ function setIgnoreAreas(
6785 `${ API_URL } ${ ENDPOINT_URL } /ignoreArea/${ id } ` ,
6886 requestOptions
6987 ) . then ( handleResponse ) ;
70- }
88+ }
0 commit comments