Improve Test Coverage for `permissionCtrl.js` (Current: 36.36%)
@Akshat453 is already working on this.
Since Jun 18, 2025.
- Dominant language
- Python
- Stars
- 2k
- Forks
- 983
- Avg merge
- 2h 54m
- Merged PRs (30d)
- 14
Description
**Description:**
The file `EvalAI/frontend/src/js/controllers/permissionCtrl.js` currently has **low test coverage**, with only **36.36%** according to the latest Codecov report. This controller includes important logic such as the ability for users to request a new email verification link, which is currently **under-tested**.
The `requestLink()` function, in particular, handles a critical piece of user interaction and should be thoroughly tested to prevent regressions and ensure a reliable user experience.
---
### ✅ Focus Area: `requestLink()`
The `requestLink()` method sends a **POST** request to trigger a new email verification. It handles different response scenarios and interacts with the UI via `$rootScope.notify()`.
#### Tests to Add:
* [ ] Ensure `utilities.sendRequest()` is called with the correct:
* URL
* HTTP method (`POST`)
* Token
* [ ] Simulate **successful POST** response:
* Assert that `vm.sendMail` is set to `true`
* Assert that `$rootScope.notify()` displays a **success message**
* [ ] Simulate **400/500 error** response:
* Assert that a **generic error notification** is triggered via `$rootScope.notify()`
---
### 📈 Goal
Increase test coverage of `permissionCtrl.js` to **above 90%**, with full test validation of `requestLink()`'s behavior across success and failure flows.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.