aglinxinyuan opened a new issue, #6261:
URL: https://github.com/apache/texera/issues/6261

   ### 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.
   
   ```ts
   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
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to