Skip to content

Commit

Permalink
Solve task service spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiahub committed Jul 18, 2023
1 parent 5349def commit 3146f93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions ui/src/app/shared/api/task.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('shared/api/task.service.ts', () => {
const httpUri = mockHttp.post.calls.mostRecent().args[0];
const headerArgs = mockHttp.post.calls.mostRecent().args[2].headers;
const httpParams = mockHttp.post.calls.mostRecent().args[2].params;
expect(httpUri).toEqual('/tasks/executions');
expect(httpUri).toEqual('/tasks/executions/launch');
expect(headerArgs.get('Content-Type')).toEqual('application/json');
expect(headerArgs.get('Accept')).toEqual('application/json');
expect(httpParams.get('name')).toEqual('foo');
Expand Down Expand Up @@ -120,10 +120,10 @@ describe('shared/api/task.service.ts', () => {

it('getExecution', () => {
mockHttp.get.and.returnValue(of(jsonData));
taskService.getExecution('foo', 'boot3');
taskService.getExecution(0, 'boot3');
const httpUri = mockHttp.get.calls.mostRecent().args[0];
const headerArgs = mockHttp.get.calls.mostRecent().args[1].headers;
expect(httpUri).toEqual('/tasks/executions/foo');
expect(httpUri).toEqual('/tasks/executions/0');
expect(headerArgs.get('Content-Type')).toEqual('application/json');
expect(headerArgs.get('Accept')).toEqual('application/json');
});
Expand Down
9 changes: 4 additions & 5 deletions ui/src/app/shared/api/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,8 @@ export class TaskService {
executionClean(taskExecution: TaskExecution): Observable<any> {
const headers = HttpUtils.getDefaultHttpHeaders();
const params = new HttpParams({encoder: new DataflowEncoder()})
.append('action', 'REMOVE_DATA')
.append('schemaTarget', taskExecution.schemaTarget);
const url = UrlUtilities.calculateBaseApiUrl() + `tasks/executions/${taskExecution.executionId}`;
const url = UrlUtilities.calculateBaseApiUrl() + `tasks/executions/${taskExecution.executionId}?action=REMOVE_DATA`;
return this.httpClient
.delete<any>(url, {
headers,
Expand Down Expand Up @@ -188,7 +187,7 @@ export class TaskService {
const headers = HttpUtils.getDefaultHttpHeaders();
const params = new HttpParams({encoder: new DataflowEncoder()}).set('schemaTarget', schemaTarget);
return this.httpClient
.get<any>(UrlUtilities.calculateBaseApiUrl() + `tasks/executions/${executionId}`, {
.get<any>(UrlUtilities.calculateBaseApiUrl() + `tasks/executions/${executionId ?? 0}`, {
headers: headers,
params: params
})
Expand All @@ -210,9 +209,9 @@ export class TaskService {
}
});
}
const params = new HttpParams({encoder: new DataflowEncoder()}).append('platformName', platformName);
const params = new HttpParams({encoder: new DataflowEncoder()});
return this.httpClient
.get<any>(UrlUtilities.calculateBaseApiUrl() + `tasks/logs/${taskExecution.externalExecutionId}`, {
.get<any>(UrlUtilities.calculateBaseApiUrl() + `tasks/logs/${taskExecution.externalExecutionId}?platformName=${platformName}`, {
headers,
params
})
Expand Down

0 comments on commit 3146f93

Please sign in to comment.