Files
openobserve/web
Sai Nikhil 3457b14e34 fix: added additional unit test cases (#7926)
### **User description**
This PR 

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

-----------------------------------------------|---------|----------|---------|---------|-------------------------
All files | 40.59 | 71.46 | 35.29 | 40.59 |


___

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


___

### **Description**
- Add comprehensive unit tests across modules

- Expand AlertList tests with robust mocks

- Add Quota internals exposure for testing

- Improve mocks and utilities in specs


___

### Diagram Walkthrough


```mermaid
flowchart LR
  AlertsSpec["AlertList.spec.ts"]
  AddAlertSpec["AddAlert.spec.ts"]
  LogsSpec["logs/Index.spec.ts"]
  QuotaSpec["iam/quota/Quota.spec.js"]
  EditRoleSpec["iam/roles/EditRole.spec.js"]
  OrgSpec["iam/organizations/AddUpdateOrganization.spec.js"]
  QuotaVue["iam/quota/Quota.vue (expose internals)"]

  AlertsSpec -- "mock services, actions, filters" --> AlertList["AlertList.vue"]
  AddAlertSpec -- "mocks, payload/SQL generation" --> AddAlert["AddAlert.vue"]
  LogsSpec -- "UI behaviors, watchers, analytics" --> LogsIndex["Index.vue"]
  QuotaSpec -- "api/role limits flows" --> QuotaVue
  EditRoleSpec -- "permissions, JSON sync, tabs" --> EditRole["EditRole.vue"]
  OrgSpec -- "create org flows" --> Organizations["AddUpdateOrganization.vue"]
  QuotaVue -- "expose apiCategories, helpers" --> QuotaSpec
```



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

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>1
files</summary><table>
<tr>
<td><strong>Quota.vue</strong><dd><code>Expose internal helpers for unit
testing</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7926/files#diff-30293eb5cb924f95356d5abd4588ce0f03765ac9d4446cf5b8cbacba23c6f979">+6/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

</table></details></td></tr><tr><td><strong>Tests</strong></td><td><details><summary>6
files</summary><table>
<tr>
<td><strong>AlertList.spec.ts</strong><dd><code>Rewrite and expand
AlertList unit tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7926/files#diff-d905f71e43a305b4d4212d64739bac53611207318fa96d6f146928c592849762">+693/-150</a></td>

</tr>

<tr>
<td><strong>Index.spec.ts</strong><dd><code>Add broader Logs Index tests
and setup</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7926/files#diff-a6ac1dd4a120625f1c0ed23803aa0cb63e8513b38abc975af72eefe3923b2c73">+266/-3</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>AddAlert.spec.ts</strong><dd><code>Strengthen AddAlert tests
and mocks</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7926/files#diff-84362398fea8abd9acf30f4f40ba8d4cf27348677454017bd4e6f568d5176ac6">+211/-9</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>Quota.spec.js</strong><dd><code>New Quota page comprehensive
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; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7926/files#diff-98af0e50f753baa4aa42469587475b48d47f3119dba8aa8934f8ad1be7d06b1d">+511/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>EditRole.spec.js</strong><dd><code>New EditRole extensive
permissions tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7926/files#diff-5948de10fa676a2f3054ae3b0868a00a3d63f2cd7ac02b5985457ed5ea2bf28a">+455/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>AddUpdateOrganization.spec.js</strong><dd><code>New
Add/Update Organization flow tests</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7926/files#diff-a9e0d48be1f9ffab759135372ac67a381fc6330a2646325bf989a8f34e52ff28">+124/-0</a>&nbsp;
</td>

</tr>
</table></details></td></tr><tr><td><strong>Additional
files</strong></td><td><details><summary>1 files</summary><table>
<tr>
  <td><strong>O2AIChat.spec.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/7926/files#diff-d7a87348aec28e5ec4466134fbe23335149a36f3e15519b41e1e78897c5c2f87">+422/-0</a>&nbsp;
</td>

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

</details>

___
2025-08-18 14:21:18 +05:30
..
2023-02-02 09:03:11 +05:30
2023-08-06 01:29:13 +08:00
2023-02-02 09:03:11 +05:30
2023-02-02 09:03:11 +05:30
2023-02-02 09:03:11 +05:30
2025-08-11 17:06:35 -07:00
2024-04-03 12:49:25 +05:30
2023-02-02 09:03:11 +05:30

web

This template should help get you started developing with Vue 3 in Vite.

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).

Type Support for .vue Imports in TS

TypeScript cannot handle type information for .vue imports by default, so we replace the tsc CLI with vue-tsc for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:

  1. Disable the built-in TypeScript Extension
    1. Run Extensions: Show Built-in Extensions from VSCode's command palette
    2. Find TypeScript and JavaScript Language Features, right click and select Disable (Workspace)
  2. Reload the VSCode window by running Developer: Reload Window from the command palette.

Customize configuration

See Vite Configuration Reference.

Project Setup

npm install

Compile and Hot-Reload for Development

For stand-alone UI development environment, create .env file and which contains below environment variable

VITE_OPENOBSERVE_ENDPOINT=http://localhost:5080/
npm run dev

Type-Check, Compile and Minify for Production

npm run build

Run Unit Tests with Vitest

npm run test:unit

Run End-to-End Tests with Cypress

npm run test:e2e:dev

This runs the end-to-end tests against the Vite development server. It is much faster than the production build.

But it's still recommended to test the production build with test:e2e before deploying (e.g. in CI environments):

npm run build
npm run test:e2e

Lint with ESLint

npm run lint