Aman-Mittal opened a new issue, #678:
URL: https://github.com/apache/fineract-backoffice-ui/issues/678

   One of the smaller ratchet entries, and an unusual one: **every violation is 
in a spec file.** Production code already goes through the `STORAGE` adapter; 
it is the tests that reach `localStorage` directly.
   
   ```
   4  src/app/core/services/auth.service.test.ts
   5  src/app/core/services/institution-config.service.test.ts
   4  src/app/core/services/navigation-config.service.test.ts
   2  src/app/shared/directives/has-institution-feature.directive.test.ts
   ```
   
   ## Why it matters more than the count suggests
   
   `no-restricted-globals` exists because Web Storage is a trust boundary 
(`security.md` §4) reached through a global rather than an import, and 
`STORAGE_KEYS` is meant to be the reviewable inventory of what this origin 
persists. A spec that writes `localStorage` directly is also a spec that can 
pass while the adapter is bypassed — and it leaves state behind for whatever 
test runs next, since the key never goes through the inventory.
   
   ## What to do
   
   Use the fake storage adapter from `src/app/testing/adapters` 
(`provideFakeAdapters()`) instead of touching `localStorage`, and assert 
against it. Declare any key the test needs in 
`core/adapters/storage/storage-keys.ts` if it is not there already.
   
   ## Acceptance
   
   - `no-restricted-globals` is gone from `eslint-suppressions.json` after `npm 
run lint:prune`.
   - No spec writes or reads `localStorage`/`sessionStorage` directly.
   - `npm run lint` passes and the suite still passes.
   
   Background: `DOCS/adr/0003-adapter-boundary.md`, `DOCS/ADAPTERS.md#storage`.
   


-- 
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