Cloud-CV / Cloud-CV/EvalAI

Improve Test Coverage for `permissionCtrl.js` (Current: 36.36%)

Open
#4,679 0 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.