Commit Graph
3 Commits
Author SHA1 Message Date
Sai Nikhil 4da7bf82dc fix: added more unit test cases (#7903)
### **User description**
added unit test cases
1. enrichment module 
2. functions module
3. added additional test cases for indexlist
4. search history 
5. search scheduler list


___

### **PR Type**
Enhancement, Tests


___

### **Description**
- Expose `handleSearchResponse` and `handleSearchReset` in
`IndexList.vue`

- Expose `getTimeRange` in `EnrichmentTableList.vue`

- Add extensive unit tests for `IndexList` search and field flows

- Extend specs for enrichment, function, scheduler, and utility tests


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["IndexList.vue"] -- "expose handlers" --> B["UnitTests"]
  C["EnrichmentTableList.vue"] -- "expose getTimeRange" --> B
  D["AddEnrichmentTable.vue"] -- "enhance error tests" --> B
  E["OtherComponents"] -- "add comprehensive specs" --> B
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody></tr></tbody></table>

</details>

___
2025-08-08 12:31:47 +05:30
Sai Nikhil 5453920b9a fix: unit test cases for reports module (#7882)
### **User description**
This PR adds unit test cases for reports module and the coverage as of
now

File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s

-----------------------------------------------|---------|----------|---------|---------|----------------------------------------------------------
All files | 34.41 | 70.18 | 29.47 | 34.41 |


___

### **PR Type**
Tests


___

### **Description**
- Add comprehensive CreateReport tests

- Add comprehensive ReportList tests

- Mock services and dependencies

- Validate form flows and error handling


___



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>CreateReport.spec.js</strong><dd><code>Add CreateReport
component tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

web/src/components/reports/CreateReport.spec.js

<ul><li>Mock dashboardService and reports service<br> <li> Test
component initialization and rendering<br> <li> Test form navigation and
validation steps<br> <li> Test report creation, editing, and
cancellation</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7882/files#diff-8a0f39751d08a258c4997c5e68edaf167ea01477528beee2295dd9f992310cc6">+1793/-0</a></td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>ReportList.spec.js</strong><dd><code>Add ReportList
component tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

web/src/components/reports/ReportList.spec.js

<ul><li>Mock reports service and router<br> <li> Test listing,
pagination, and filtering<br> <li> Test report state toggle and
deletion<br> <li> Test navigation to create and edit pages</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7882/files#diff-c3de3f1590ac7b4401cf5570a52f0dcf6471898e4ffc7ccbc19166ba600a181f">+633/-0</a>&nbsp;
</td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___
2025-08-07 11:17:05 +05:30
Bhargavandsai nikhil kethe b032141aae fix: added unit test case coverage (#7788)
### **PR Type**
Tests, Enhancement


___

### **Description**
- Include coverage thresholds in Vitest config

- Introduce Bash script for coverage checks

- Extend CI to run frontend coverage checks

- Update npm scripts for coverage verification


___



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Configuration
changes</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>vitest.config.ts</strong><dd><code>Add coverage
thresholds to Vitest config</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

web/vitest.config.ts

<ul><li>Add "json-summary" to coverage reporters<br> <li> Define
coverage thresholds (80%) for all metrics<br> <li> Keep existing
exclude/include patterns</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7788/files#diff-c3fc010b682e68f2ed0b7b1485b8aa513443a66d500903b8dff1d65908d02aae">+7/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>package.json</strong><dd><code>Update npm coverage
scripts</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

web/package.json

<ul><li>Modify "test:unit:coverage" to use "--run"<br> <li> Add
"test:coverage:check" script pointing to "./coverage.sh check"</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7788/files#diff-b861012a5dd72b8a9f3281b7cf09f5a779c98569d040b1bbc1db50f1b15e7cce">+2/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>coverage.sh</strong><dd><code>Add coverage utility Bash
script</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

web/coverage.sh

<ul><li>New Bash script supporting "check", "html", "test",
"show-env"<br> <li> Enforce coverage thresholds via Python JSON
parsing<br> <li> Provide usage/help output and environment overrides<br>
<li> Handle errors and missing summary file</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7788/files#diff-a5c51d1d52fd0ff1b77a2dae626334fe574e76d9269a35655543ec4ead5575d2">+140/-0</a>&nbsp;
</td>

</tr>
</table></td></tr><tr><td><strong>Tests</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>unit-tests.yml</strong><dd><code>Integrate frontend
coverage in CI workflow</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

.github/workflows/unit-tests.yml

<ul><li>Add "frontend_tests" job for coverage checks<br> <li> Skip tests
if no changes under "web/" directory<br> <li> Setup Node.js and install
dependencies<br> <li> Invoke "./coverage.sh check" in CI</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7788/files#diff-cd0effce06f425599e96952f4d5f684641a683f46d9909e7c74a9f8b2f03ccd3">+29/-0</a>&nbsp;
&nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai>
2025-08-06 14:38:00 +05:30