Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('Activity Service', () => {
});

it('activities are delete using DELETE from baseUrl', () => {
const url = `${service.baseUrl}/1`;
const url = `${service.baseUrl}/id:1`;
service.deleteActivity(activities[0].id).subscribe((activitiesInResponse) => {
expect(activitiesInResponse.filter((activity) => activity.id !== activities[0].id)).toEqual([activities[1]]);
});
Expand All @@ -73,7 +73,7 @@ describe('Activity Service', () => {
service.updateActivity(activity).subscribe((response) => {
expect(response.name).toBe('aaa');
});
const updateActivitiesRequest = httpMock.expectOne(`${service.baseUrl}/${activity.id}`);
const updateActivitiesRequest = httpMock.expectOne(`${service.baseUrl}/id:${activity.id}`);
expect(updateActivitiesRequest.request.method).toBe('PUT');
updateActivitiesRequest.flush(activity);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export class ActivityService {
}

deleteActivity(acitivityId: string): Observable<any> {
const url = `${this.baseUrl}/${acitivityId}`;
const url = `${this.baseUrl}/id:${acitivityId}`;
return this.http.delete(url);
}

updateActivity(activityData): Observable<any> {
const url = `${this.baseUrl}/${activityData.id}`;
const url = `${this.baseUrl}/id:${activityData.id}`;

const body = {
...activityData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('Activity Service', () => {
});

it('ProjectTypes are delete using DELETE from baseUrl', () => {
const url = `${service.baseUrl}/1`;
const url = `${service.baseUrl}/id:1`;
service.deleteProjectType(projectTypes[0].id).subscribe((projectTypesInResponse) => {
expect(projectTypesInResponse.filter((activity) => activity.id !== projectTypes[0].id)).toEqual([
projectTypes[1],
Expand All @@ -70,12 +70,12 @@ describe('Activity Service', () => {
it('update activity using PUT from baseUrl', () => {
const projectType = { id: '1', name: 'aaa', description: 'bbb' };

service.baseUrl = 'project-type' + '/' + projectType.id;
service.baseUrl = 'project-type' + '/id:' + projectType.id;

service.updateProjectType(projectType).subscribe((response) => {
expect(response.name).toBe('aaa');
});
const updateProjectTypeRequest = httpMock.expectOne(`${service.baseUrl}/${projectType.id}`);
const updateProjectTypeRequest = httpMock.expectOne(`${service.baseUrl}/id:${projectType.id}`);
expect(updateProjectTypeRequest.request.method).toBe('PUT');
updateProjectTypeRequest.flush(projectType);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export class ProjectTypeService {
}

deleteProjectType(projectTypeId: string): Observable<any> {
const url = `${this.baseUrl}/${projectTypeId}`;
const url = `${this.baseUrl}/id:${projectTypeId}`;
return this.http.delete(url);
}

updateProjectType(projectTypeData): Observable<any> {
const url = `${this.baseUrl}/${projectTypeData.id}`;
const url = `${this.baseUrl}/id:${projectTypeData.id}`;
return this.http.put(url, projectTypeData);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('ProjectService', () => {
service.updateProject(project).subscribe((response) => {
expect(response.name).toBe('new name');
});
const updateProjectRequest = httpMock.expectOne(`${service.url}/${project.id}`);
const updateProjectRequest = httpMock.expectOne(`${service.url}/id:${project.id}`);
expect(updateProjectRequest.request.method).toBe('PUT');
updateProjectRequest.flush(project);
});
Expand All @@ -98,7 +98,7 @@ describe('ProjectService', () => {
service.updateProject(project).subscribe((response) => {
expect(response.name).toBe('new name');
});
const updateProjectRequest = httpMock.expectOne(`${service.url}/${project.id}`);
const updateProjectRequest = httpMock.expectOne(`${service.url}/id:${project.id}`);
expect(updateProjectRequest.request.method).toBe('PUT');
updateProjectRequest.flush(project);
});
Expand All @@ -115,7 +115,7 @@ describe('ProjectService', () => {
});

it('update status project using PUT from baseUrl locally', () => {
const url = `${service.url}/1`;
const url = `${service.url}/id:1`;
service.isDevelopment = true;
service.deleteProject(projectsList[0].id).subscribe((projectsInResponse) => {
expect(projectsInResponse.filter((project) => project.id !== projectsList[0].id).length).toEqual(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ export class ProjectService {
projectData.status = 1;
}
}
return this.http.put(`${this.url}/${id}`, projectData);
return this.http.put(`${this.url}/id:${id}`, projectData);
}

deleteProject(projectId: string): Observable<any> {
return this.isDevelopment
? this.http.put(`${this.url}/${projectId}`, { status: 0 })
? this.http.put(`${this.url}/id:${projectId}`, { status: 0 })
: this.http.delete(`${this.url}/${projectId}`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('CustomerService', () => {
{ name: 'aa', description: 'bb', tenant_id: 'cc', id: '1' },
{ name: 'xx', description: 'yy', tenant_id: 'zz', id: '2' },
];
const url = `${service.baseUrl}/1`;
const url = `${service.baseUrl}/id:1`;
service.deleteCustomer(customer[0].id).subscribe();
const getCustomerRequest = httpMock.expectOne(url);

Expand All @@ -55,13 +55,13 @@ describe('CustomerService', () => {

it('update customer using PUT from baseUrl', () => {
const customer = { id: '1', name: 'aaa', description: 'bbb' };
service.baseUrl = 'customers' + '/' + customer.id;
service.baseUrl = 'customers' + '/id:' + customer.id;

service.updateCustomer(customer).subscribe((response) => {
expect(response.name).toBe('aaa');
});

const updateCustomerRequest = httpMock.expectOne(`${service.baseUrl}/${customer.id}`);
const updateCustomerRequest = httpMock.expectOne(`${service.baseUrl}/id:${customer.id}`);

expect(updateCustomerRequest.request.method).toBe('PUT');
updateCustomerRequest.flush(customer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export class CustomerService {
}

deleteCustomer(customerId: string): Observable<any> {
const url = `${this.baseUrl}/${customerId}`;
const url = `${this.baseUrl}/id:${customerId}`;
return this.http.delete(url);
}

updateCustomer(customerData): Observable<any> {
const url = `${this.baseUrl}/${customerData.id}`;
const url = `${this.baseUrl}/id:${customerData.id}`;
return this.http.put(url, customerData);
}
}
4 changes: 2 additions & 2 deletions src/app/modules/time-clock/services/entry.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('EntryService', () => {

service.updateEntry(updatedEntry).subscribe();

const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/id`);
const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/id:id`);
expect(updateEntryRequest.request.method).toBe('PUT');
});

Expand All @@ -79,7 +79,7 @@ describe('EntryService', () => {

service.deleteEntry(entry).subscribe();

const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/${entry}`);
const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/id:${entry}`);
expect(updateEntryRequest.request.method).toBe('DELETE');
});

Expand Down
4 changes: 2 additions & 2 deletions src/app/modules/time-clock/services/entry.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ export class EntryService {

updateEntry(entryData): Observable<any> {
const {id} = entryData;
return this.http.put(`${this.baseUrl}/${id}`, entryData);
return this.http.put(`${this.baseUrl}/id:${id}`, entryData);
}

deleteEntry(entryId: string): Observable<any> {
const url = `${this.baseUrl}/${entryId}`;
const url = `${this.baseUrl}/id:${entryId}`;
return this.http.delete(url);
}

Expand Down