Task Summary
Add share-access.service.spec.ts covering ShareAccessService, the REST client for grant / revoke / owner / list of resource share-access. Use Angular's HttpTestingController to assert exact URL composition per method.
Background
frontend/src/app/dashboard/service/user/share-access/share-access.service.ts composes four endpoints under ${AppSettings.getApiEndpoint()}/access. The URL assembly (path segments interpolated from args) is the contract worth pinning.
grantAccess(type, id, email, privilege) { return this.http.put(`${BASE}/${type}/grant/${id}/${email}/${privilege}`, null); }
revokeAccess(type, id, username) { return this.http.delete(`${BASE}/${type}/revoke/${id}/${username}`); }
getOwner(type, id) { return this.http.get(`${BASE}/${type}/owner/${id}`, { responseType: "text" }); }
getAccessList(type, id) { return this.http.get(`${BASE}/${type}/list/${id}`); }
Behavior to pin
| Method |
Contract (assert with HttpTestingController) |
grantAccess |
PUT .../access/{type}/grant/{id}/{email}/{privilege} |
revokeAccess |
DELETE .../access/{type}/revoke/{id}/{username} |
getOwner |
GET .../access/{type}/owner/{id} with responseType: "text" |
getAccessList |
GET .../access/{type}/list/{id}; resolves to the returned array |
Set up TestBed with HttpClientTestingModule (or provideHttpClientTesting); flush() each expected request and httpMock.verify() in afterEach. Any existing *.service.spec.ts under frontend/src/app using HttpTestingController is a good template.
Scope
- New spec:
frontend/src/app/dashboard/service/user/share-access/share-access.service.spec.ts.
- No production-code changes.
Task Type
Task Summary
Add
share-access.service.spec.tscoveringShareAccessService, the REST client for grant / revoke / owner / list of resource share-access. Use Angular'sHttpTestingControllerto assert exact URL composition per method.Background
frontend/src/app/dashboard/service/user/share-access/share-access.service.tscomposes four endpoints under${AppSettings.getApiEndpoint()}/access. The URL assembly (path segments interpolated from args) is the contract worth pinning.Behavior to pin
HttpTestingController)grantAccessPUT .../access/{type}/grant/{id}/{email}/{privilege}revokeAccessDELETE .../access/{type}/revoke/{id}/{username}getOwnerGET .../access/{type}/owner/{id}withresponseType: "text"getAccessListGET .../access/{type}/list/{id}; resolves to the returned arraySet up
TestBedwithHttpClientTestingModule(orprovideHttpClientTesting);flush()each expected request andhttpMock.verify()inafterEach. Any existing*.service.spec.tsunderfrontend/src/appusingHttpTestingControlleris a good template.Scope
frontend/src/app/dashboard/service/user/share-access/share-access.service.spec.ts.Task Type