Skip to content

add unit test coverage for ShareAccessService #6261

Description

@aglinxinyuan

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

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions