Files
openobserve/web/src/components/functions/TestFunction.spec.ts
T
Sai Nikhil f78f5d79c8 fix: added unit test cases (#8121)
### **User description**
with this PR the coverage is 

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

-----------------------------------------------|---------|----------|---------|---------|-------------------------------------------------------------------------------------
All files | 48.05 | 82.25 | 50.81 | 48.05 |


___

### **PR Type**
Enhancement, Tests, Bug fix


___

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

- Expose component internals for testability

- Safely access org identifier with optional chaining

- Minor exports to composables for testing


___

### Diagram Walkthrough


```mermaid
flowchart LR
  components["Vue components"]
  expose["Expose methods/refs via defineExpose"]
  specs["New/expanded unit tests"]
  fixOrg["Optional chaining for org identifier"]
  composables["Composables export additions"]

  components -- "defineExpose, returns additions" --> expose
  expose -- "enables" --> specs
  components -- "query params use ?.identifier" --> fixOrg
  composables -- "export more helpers" --> specs
```



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

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><details><summary>1 files</summary><table>
<tr>
<td><strong>index.vue</strong><dd><code>Use optional chaining for org
identifier in routes</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-699c63979f851c48ad440a078e93282fd797a18fc065e5331b2e41122ddb8b69">+15/-13</a>&nbsp;
</td>

</tr>

</table></details></td></tr><tr><td><strong>Tests</strong></td><td><details><summary>39
files</summary><table>
<tr>
<td><strong>Stream.vue</strong><dd><code>Expose stream form methods and
state for tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-1a17ced9dc89022502cab0a6f9b97b413c2a2c4f8219733d063fc0180d361739">+33/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>RealTimeAlert.vue</strong><dd><code>Expose alert editor
methods/data for tests</code>&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/8121/files#diff-c3ae6b47832eb33f9ca877cc7165d079de14850e5c5d43a227102ba40326b9d8">+19/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>ExternalDestination.vue</strong><dd><code>Expose destination
form functions and state</code>&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/8121/files#diff-7ed6a9ef676d7d6db5440d4157512f731bad58716c351ca39015125a8a9d2df5">+22/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>PerformanceSummary.vue</strong><dd><code>Export additional
helpers and imports for tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-fdf59594c111c1af03772c9deef4ba07cf2c2d00c9609737a0ea3e3c76fb1c1b">+3/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>StreamFieldInputs.vue</strong><dd><code>Expose field input
handlers and state</code>&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/8121/files#diff-c8173413939f320f197b0f8790e619da18666f79009345f72b3325e89bbb7566">+17/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>FilterGroup.vue</strong><dd><code>Expose group manipulation
helpers for testing</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-8d5a73bea3aa0b5c86d48cda4a61ee3e30f27797ac2a5add1ee8bd66c75bef23">+17/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>ImportDestination.vue</strong><dd><code>Expose validation
and helper functions</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/8121/files#diff-814b8ef1dbb4eebca9dfab72452d9a90d5f3fa5886dea8e82ac0bde44f66b445">+7/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>PipelinesDestinationList.vue</strong><dd><code>Expose list
helper functions and selectedPerPage</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-088c66f5a34e73a5350a794a772e5d905262277337c937dd36f4295072203ebf">+6/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>SearchBar.vue</strong><dd><code>Expose additional editor and
action handlers</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-81893de4edf186b0556f610acb280c87baa2ffe67d3b48a60a866094c7635baf">+11/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>ImportTemplate.vue</strong><dd><code>Expose template
validation and helpers</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/8121/files#diff-d22684c5142a49b8925a9dba1ef67631128caa95de66e71ba2a5b8120a0b91c6">+6/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>IndexList.vue</strong><dd><code>Expose websocket/search
helper functions</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/8121/files#diff-08f058f883b659e713e606991a7ea37ae1ff016b7cccef970489ab5840dc3d09">+11/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>ImportAlert.vue</strong><dd><code>Expose alert validation
helpers</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; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-0f40dbf2757672e39ad16b86dddc59b568ca2e6ca36850420cd7be617da12d38">+4/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>AlertsDestinationList.vue</strong><dd><code>Expose
destination list helpers for tests</code>&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/8121/files#diff-e9d05ba6c071c0e2f5d9ef7acdef757f79910abd6897b29e27b069a10d4ba8de">+7/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>SysLog.vue</strong><dd><code>Expose syslog route helpers and
state</code>&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/8121/files#diff-2f538c29fd1d51aa470edad915666faca1deade7413645f033f2a67354b3726c">+9/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>TelegrafConfig.vue</strong><dd><code>Expose ingestionURL in
setup for 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/8121/files#diff-f934fcfd5f71fff85e099f5ddf133a1cdd2a02aa3ade339dee73d54474480acf">+2/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>schema.vue</strong><dd><code>Expose schema helpers and
formatters</code>&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/8121/files#diff-9196be2ccae4054a00b0b1aa9d1e87b366c10920d6eaf9ef8c6e6293d50bcf46">+7/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>AssociatedRegexPatterns.vue</strong><dd><code>Expose pattern
state/check helpers</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/8121/files#diff-c6fce5e1c83798991b6ff19effb23c67af59f38fac0b9e56dcab7a09d139f550">+6/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>AddFolder.vue</strong><dd><code>Return defaultValue for
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; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-41d2f8fac44084c004d8386ea4cc32e9c5d3e33266c4009cc855e57fb00a41af">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>ImportRegexPattern.vue</strong><dd><code>Expose regex
pattern validation and helpers</code>&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/8121/files#diff-e8e1bcb5a02311504d7d571090eab27a270aaa71cae185ad2703023e2e70a31e">+4/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>SearchSchedulersList.vue</strong><dd><code>Expose date
helpers and router</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></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-0c0a4097c53f07712d35562b1336602bf24faddedab77a9f5717f5582dcac2f1">+5/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>MoveAcrossFolders.vue</strong><dd><code>Expose getModuleName
from setup</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; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-3826ffbf7e4cbae5b621527c9df856e1bd3b349b78d4a6c514b6967636d04237">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>SearchResult.vue</strong><dd><code>Expose row/partition
helpers and column sizes</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-5e65533aa4754bb6d0074fda18ffc1ecacded3b9ca6bc28a161c3f6b12f20195">+5/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>AddUpdateTicket.vue</strong><dd><code>Expose
validation/upload methods via expose</code>&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/8121/files#diff-bd6f97ffe635a2127610e0bbc94b1c9fe40a6ca1dff98e72efc4a449116c59db">+2/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>usage.vue</strong><dd><code>Expose getUsage and
router</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; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-87c1e1d75e488a25773db68ada1e49913ad50be7971fbb588939941a3ea6302b">+2/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>Databricks.vue</strong><dd><code>Expose database config
state</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; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-2ff8f0c23b75de8b87f86d00af9de4f6c8ceb335ade6cbef227cb37f26d42ae6">+4/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>SqlServer.vue</strong><dd><code>Expose database config
state</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; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-23653eb1e4b5fa9fc519ac44cdf06b01e645d61c86340e59fcf58eb11702008f">+5/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>JsonPreview.vue</strong><dd><code>Expose getTracesStreams
function</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></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-3985073134d35ff074742944b114d0905524038b42e6d2ac887fef2c8436fb16">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>VisualizeLogsQuery.vue</strong><dd><code>Expose hovered
series and metadata</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/8121/files#diff-979b01d943d58c5d70faeeac5948b7f02f0b2392a12b84ef07ba7f7393ab0261">+2/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>FrontendRumConfig.vue</strong><dd><code>Expose defaultConfig
for 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></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-a90414833508a6d5f76b245c65f2a2ff067ada5e1c5c09b1b53598a4881e2676">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>OpenTelemetry.vue</strong><dd><code>Expose ingestionURL in
setup</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; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-45be3e74a543860331e1cbb11c299a81d5f2e49030bcc3eab03dd6db09f93c5b">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>Index.vue</strong><dd><code>Expose ingestRoutes for
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; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-a8ce6281b41747a4c58b111d6c31a57f8597b2c33f79d9b236af548d5683b200">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>PipelineFlow.vue</strong><dd><code>Expose store and
setViewport</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; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-9c7475a54f0c895dd49eb0c5b53fe0a76ceff0520f667a9cb065b364557ced50">+2/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>MessageQueues.vue</strong><dd><code>Expose
messageQueueTabs</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; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-ab520bb9b203fc532d2544ba60b140600cbc0efb9773e000c1867076275780bc">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>Database.vue</strong><dd><code>Expose
databaseTabs</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-9f043be1b81e96e163d333d8fac934fbd8cf9009076eeaaf2bd8ee360a3e913c">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>Languages.vue</strong><dd><code>Expose
languagesTabs</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-5ac446e8fed967883b402dfe4ff686717138a76f0333c2416a6b6f955a0086fc">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>Networking.vue</strong><dd><code>Expose
networkingTabs</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-ca61b8331afde2b46c0a193e0cc31e2b6b8a915aad1841fbbda229450af02726">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>Recommended.vue</strong><dd><code>Expose
recommendedTabs</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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-d52f7f52bf8f6d3d639e5d0a550bed82223cd4fbd3eee3c257b7f80e0b8ee6d2">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
<td><strong>SearchBar.spec.ts</strong><dd><code>Rewrite and expand
SearchBar 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/8121/files#diff-63ac75d3fe278dad233e7dd7c51b3b33076d54a776b89ae05190d8522130c78b">+1058/-1118</a></td>

</tr>

<tr>
<td><strong>GCPConfig.spec.ts</strong><dd><code>Add unit tests for GCP
config logic</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/8121/files#diff-76e896e96fdae254b7b569e0d3afdea55b05c7777d6eda2da0374fe782d74457">+533/-0</a>&nbsp;
</td>

</tr>

</table></details></td></tr><tr><td><strong>Enhancement</strong></td><td><details><summary>1
files</summary><table>
<tr>
<td><strong>usePromqlSuggestions.ts</strong><dd><code>Export additional
suggestion helpers/state</code>&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/8121/files#diff-250bf4b2d8cb3845005f72188d73ab954359f841e15c4f217708beac1493e83a">+4/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></details></td></tr><tr><td><strong>Additional
files</strong></td><td><details><summary>101 files</summary><table>
<tr>
  <td><strong>App.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-e5d10660c09127e3b4234cd8fe18303e53db38e43a1c5a6edb13032afbebe28f">+291/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>AutoRefreshInterval.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-4fae96431d981a4338e96dd393820e3497ed56382adc77fab6024f6efd15bd4c">+320/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>ConfirmDialog.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-16ffba01e15b66513827b99a68c002b567e65bd1124f9bcf7c4db8db5795df8a">+61/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
  <td><strong>CopyContent.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-a09160ad7355806c5f4f5b0194a6026ed7c24a77f3de0bce58ffa67c4e97de4d">+348/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>CustomDateTimePicker.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-f3c4dc21e87d485ae2d167b1f4e993ffc00b941b207a664ea504468842f4d428">+338/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>DateTime.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-ee6ae1a77af32afb0b0410cbe812d546c8639815748908e716d48a189695d8ec">+543/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>MenuLink.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-bd04ff500fc31583a430993830eed36cdf6254c2ce1a52b8a58a07b89bb9f825">+56/-4</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
  <td><strong>PendingSubscriptionWarning.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-a38d050077b70a4e16ed3fa89df6978e0d15284b824fc1840ed3d0f10403f9f8">+301/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>ResumePipelineDialog.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-ca982d78b8c120585dcf75837fbc09426c3fa2dd7e0f3a8d6cdbf9954aee6027">+136/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>RouteTabs.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-f4940a707bb9a1790b34d87c2588bb957876214edbfaf0072b2519afe230d077">+400/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>SanitizedHtmlRenderer.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-b45de775a1fc42af052b7af7b5c0b40512fab530db228a548e5bbe0510e774de">+350/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>FileItem.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-189b4998b9446d2b44aa820117eb54f555e15fb5d12dbd5bf61b4722fbc85b4e">+395/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>ScriptEditor.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-7989b3c2125f44e258f2e1e12dbb6e0608c2cfd6165619815501c8a4548b641c">+408/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>ScriptToolbar.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-5057edcc2e7f7f2bd115d1ad3b00bb668607662edee60131ba04fd078e41eaef">+412/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>AddAlert.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-84362398fea8abd9acf30f4f40ba8d4cf27348677454017bd4e6f568d5176ac6">+5/-3</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
  <td><strong>AlertsDestinationList.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-796a77635e67bca70cc19a671e1862438f78a9391ede0e936763e2204bd7a876">+709/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>FilterCondition.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-d09ca687da324598f7c1f17610406dda5c47faba21b1eba5dd606ce8f5a2671e">+463/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>FilterGroup.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-1628547d4b6650b1e87817989b84ffb25895c64ad789457b094860fcd7f13447">+1405/-0</a></td>

</tr>

<tr>
  <td><strong>ImportAlert.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-553f61b4cb949550d09d7016031a29361e4aaa22ad86f20781787bc4ccf43272">+951/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>ImportDestination.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-cf334a840c66788867f54f726f5d9431f8e1197637c641469a34e63facfcb180">+815/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>ImportTemplate.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-1a14d1b5cdc535c0fd982bcb6c02af07b647d5013922084df5d208c673eefaff">+875/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>PipelinesDestinationList.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-f749b2cdb5476b289a38418201bf27c69a7e9ab01237f6ffefc7b23392c3ff71">+529/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>RealTimeAlert.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-3b33541be3d07c04f1afd3b0a716e683b804b4f8adcba09b4fc5f3ddd0c14ef6">+693/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>ScheduledAlert.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-c85c209fe2d6eb3e8a223ddc1124e713f21ce3bbddf657be931cf8726f2e2934">+1197/-0</a></td>

</tr>

<tr>
  <td><strong>VariablesInput.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-1c6c211f8e8e49e12619c73ac450cfdc6f92f5ffc533bf09716477fa37154786">+353/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>AddCipherKey.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-1ae71f00dfb6f9424d2443856ca3a419aaf2ee0c08900f7ef2ca44e41c1982e9">+507/-467</a></td>

</tr>

<tr>
  <td><strong>AppDialog.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-28cde24b3e035186bbdf389f3c7560ba087588fd52d377c5615d50a6b5ad3dc7">+443/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>AppTabs.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-1a762da82b05a89aaea5cfac75315972be2fcc622d8dcabd9bb6e10a091a2e9d">+132/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>JsonEditor.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-be62ee12fe0b191ed850f0d8c6be49abc52596a06bfd10ac037ecc8f758d2660">+107/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>LoadingProgress.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-6096c465ac03fdbe599251405ff150d38ffc2f42be501d93723a6cc9f8eeae52">+153/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>RelativeTime.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-1ab920651a73975c32a1e00c0c6c0596866bf65b6aeec005e0d17f5084fddfef">+75/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
  <td><strong>AddFolder.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-c47fb42fd03cf2b19f7c1da98ec484699730d00d2a5ae348002df727c6f009b4">+545/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>FieldList.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-b32e6b73a1268169f32fcd0a092350e543c3d4ffb00eef685aed4ba8c36ac6a1">+907/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>MoveAcrossFolders.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-4bce3286733956ade6e6f93cc65f471314a07e610b7e3f57a95050f683fc688a">+1385/-0</a></td>

</tr>

<tr>
  <td><strong>AddFunction.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-5bf8cf7b136d01ade73a969358f28642eca484ee1f93008f2787405bc928c0df">+883/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>EnrichmentSchema.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-020714ac53ba9e0397b5f0d7fa40bbb54638a30858d2e85693e117e3616c03d1">+394/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>FullViewContainer.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-498a7631461da0b1acbb272f4e1be20f999a28cdbf66f3e2f86b2f59b82841fd">+503/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>FunctionList.spec.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-555eb5d72b94d73c66cc303b1e3cece61564b622f7b1010219a23761c21f4c55">+0/-618</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>TestFunction.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-c1b26d908f381d548650300e436d7b2e22410ef4e3d6508287c951add6633f3c">+598/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>ServiceAccountsList.spec.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-7b77b3425b30af8671b95b2c74702c89cf374669c2dc67a0b49ec182d30bedcd">+415/-99</a></td>

</tr>

<tr>
  <td><strong>AscSort.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-afc2d5fea4960d77d9f0487a89139f5409c9f55e34c3a58aedc8664cb9465c36">+200/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>DescSort.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-f6c074687e3f02ec34f0c398f64a100f5511baf1789e5dd280d48f999dfd8505">+231/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>FunctionIcon.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-5ce858f61f52bf2fdad1dc34d3ecdd852f38c66e329b6f71a4eb25f745530ada">+313/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>PipelineIcon.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-28fb2dcadc48a4bf7407fe99d2dddcd4993b430fe8398db23c786abd9cdad427">+340/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Custom.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-75fb68bb0e3ab0416c7a6840bd615a0432026c0675b7b8db80cedd8a29f07d0f">+941/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Database.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-890a9b5f5bde73f36522a300d5ada6f14fae2a94bdb3f061ac3e7d1d0cb9cd8e">+775/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>DevOps.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-8dbbccb5f29f0766ead95f3aea538f5f5b85ec3b2ff8fbedbaff50f0c5771ab4">+331/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Languages.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-34642bc2e6238f98a78fe2185eadd4995749ae336204bfb6095620369268e7d1">+753/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>MessageQueues.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-eee646fcdd254e0be152dfb3f2c6749b1710b6ec6be272b8c5f865b83d2853df">+526/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Networking.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-aff8de29d05af2b04cc0b83ab292896c79a6d68cfb3649c10ec517679b73e97e">+659/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Others.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-56f4544b83413f5b8d87c5fec280204b75388a0686c388445b3eceaef523f10e">+493/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Recommended.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-86de7fab5e678188cf1b96d463809fa645abd8d1a19d86cd3f2214b12fac3c43">+557/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Security.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-952301dec9efb69bbdc3b82753e8a7c86d64a67e3cd544fcc50f118fcd1d017e">+623/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Server.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-80a46b98c8aef2059b9d25de464c3450aa3310c02d1a4bbfcd32a706b5d0334c">+667/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Databricks.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-0cc6f4230b08c6d1f888bae4c5d9f11169714506be5f3be77b371ced9d084936">+350/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Postgres.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-046ae7ca570ff9960c83ec5fca8a95110a5158ceafda48549bdf47ccc5c71b71">+498/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>SqlServer.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-33abd49e96a5a6ecb0e07f76f3b55cb53a12674ddd450890ec185eb85e33fae3">+313/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Curl.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-755d02153c11d74b259e12605ae3ad203b01507c4f778347616ed4c1ba542024">+374/-24</a></td>

</tr>

<tr>
  <td><strong>FileBeat.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-d4f433b57979c49407559afd1b9a35131cf823a29596882f46aca6aa8789a777">+389/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>FluentBit.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-9bb84df5402b65026cdf6fe4ead0937f825f129538f4e7e6291492a9b9ade289">+362/-27</a></td>

</tr>

<tr>
  <td><strong>Fluentd.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-b0d737e6ac8536493791c38acde3b0b339bae519b8ce58fb780f794bc31f62d1">+382/-23</a></td>

</tr>

<tr>
  <td><strong>LogstashDatasource.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-2cd019295a25886a037e6ede5cad795b52851a377f48beb46f3897bc6d64a20b">+522/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>SysLog.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-98526471b0f8a5a7547c205c9da6f8b4e62f20c6ee728b687225d4ee1c564758">+966/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>SyslogNg.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-c1afe13c4d7ccf6c9e360c4beff423e785f52c05b58340acf5d0e11fbc77bfc3">+787/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Vector.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-35a48d805d8ded5b793d07c4dbb85cfafb759d073e597758cb999ed28eaf3f31">+571/-26</a></td>

</tr>

<tr>
  <td><strong>ingestionIndex.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-aa6c7d67f4885ef49f587f3dde7760ba3eabea6478e776aede5f86ab4ca76e75">+570/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>CloudWatchMetrics.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-d2e18e89f6400e04f77e4dff297030ffdf6306038d7cfe08315e0736cd0520f4">+615/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>PrometheusConfig.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-9026aa740243dc87d7be703fad5ad83e8ebdbb907b20b0f75a653ea3514dd6b4">+416/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>TelegrafConfig.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-9de7588766a4cc480d9b053d4c6dd34bad93c4e85c6580c2d8f04073f8f0fa25">+350/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>AWSConfig.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-a40ad271f4e88e42c4e746b5ce54ef0dceca122bedf3f9fa1f0571765001c680">+500/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>FrontendRumConfig.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-28bda2968dbbe401bacf2ce4a95e566d4672d59dafdf309d9a66dd567734af9a">+945/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>OpenTelemetry.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-489085e78e204c6e2b6dfdf21f1e48fef86d4bc4dd6f36869f9a2164027b3b7b">+554/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Login.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-746b43968d685362866c3f97bf2b5e0846bac7463fe1ecb080c1c7d962cb855b">+994/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>AssociatedRegexPatterns.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-4ca41bf14fd6a3c79a3877324a7c7520a25d1d33f97fe947b2f6dd4bbf6ca5b4">+1384/-0</a></td>

</tr>

<tr>
  <td><strong>Schema.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-27aac0c27d14c76ae7d02277822392d29777f07fb588bc4a19d93cc0379a25e6">+593/-677</a></td>

</tr>

<tr>
  <td><strong>StreamFieldInputs.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-a421936485eb26fe8b6c1a89cd0b40de202936fd57b49957e8ac1521a4641f57">+469/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>ExternalDestination.spec.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-716d02dd388d827ba64d21320834f07a281242627dbce78a9d29fa84e2727a42">+0/-584</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>ExternalDestination.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-a404d8244c3beb0122fbd403d2b8b410a934aacd3e498c73499204db85bc790e">+1029/-0</a></td>

</tr>

<tr>
  <td><strong>Query.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-28606cc9e509c3f1c132551ed29c46ef168444b4425cf5e81e0eff65302a9d16">+950/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>Stream.spec.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-f0e36c3bdbe8da79becc97e236de086bec117c4272ef4a7691a3330835993e40">+232/-5</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>PipelineView.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-f78a1273b1fb7f5696f364f509b6bd13a1536a160b4fd98260cc8e61750e96f9">+600/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>PipelinesList.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-afcaf75b1dd20ccf66bd61334ba262512135a3f85593310890a774421d50265e">+712/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>pipelineCommonValidation.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-820d4f4f076840724bd6f0e7b5a9da1cbacea4d074249f07c957120b6601ac38">+311/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>pipelineCommonValidation.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-b2c4c50027aace8991d17030333e880b7d4808ab04d96e9c372d82d424235ef5">+1/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
  <td><strong>CreateReport.spec.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-8a0f39751d08a258c4997c5e68edaf167ea01477528beee2295dd9f992310cc6">+0/-1854</a></td>

</tr>

<tr>
  <td><strong>PerformanceOverview.vue</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-c37f87d6d7205b9688af8c24fa6d7847c77bf35c51d4d7d1e08e6f10f3af2942">[link]</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
  <td><strong>PerformanceSummary.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-a2a97a13f8d5caa69d38d883576678dacecd8728386886f76d105e376879d60e">+1582/-0</a></td>

</tr>

<tr>
  <td><strong>ImportRegexPattern.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-1111ec8ccc0c9b62d4791101f69855ac22baa856dedd54827970f993147c3aed">+811/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>RegexPatternList.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-df942239cac609f116dcb4aa61405a60fc718219c77af46258c34e8e86e44080">+1005/-0</a></td>

</tr>

<tr>
  <td><strong>settingsIndex.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-fc96fd3ae93a42ba09577ee2c27416e9e729f2729146f88e146e4a9473626da2">+774/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>FilterCreatorPopup.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-4167cd3f9eec0c9df78517b7514c39dcc2c0234810010d93e311879971bd552e">+439/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>NoData.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-e7f5be4faf7164f86bdfea69049db3aae0509a8d33b037bfcf799347b3a0ab0d">+335/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>NoOrganizationSelected.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-1338e495c82b9d07995c13a6b245c919588012974c0f08096c7b93b5e143606c">+88/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
  <td><strong>Pagination.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-8846923daf3fe7a897ab5956098564aeb6d1748db90f637fc39f4ac8a30e1234">+110/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>AddUpdateTicket.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-8f7eb6b61a8dfdab68d5e2f73e1d2bc9580e03290d287bcfb35802331165d118">+531/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>usePermissions.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-83e050b2b1753f98e357db0e2f8a6a353b24857640c3a522a73d0d2609a0bced">+513/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>useActions.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-1bd297e5011b31dca1cb4edb6ff63a705e582dfe392e34b2e781c8051be5ee5e">+158/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>useIngestion.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-495d1e7e830eecd3e430e987a7056298d67df84282b31869bb27973aec8e4f06">+606/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>useIsMetaOrg.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-635f3965352f56c275b1309753a9f1421ffb0e8bd985b1286a012217df33eab5">+123/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>useLogs.spec.ts</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-1e4dd9056495ae6a0c1cf2b8c9e803d7372c2c1426918d848bb903b424103875">+2/-2</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
  <td><strong>Additional files not shown</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8121/files#diff-2f328e4cd8dbe3ad193e49d92bcf045f47a6b72b1e9487d366f6b8288589b4ca"></a></td>

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

</details>

___
2025-08-23 12:26:28 +05:30

598 lines
17 KiB
TypeScript

import { describe, it, expect, vi, beforeEach } from 'vitest';
import { mount } from '@vue/test-utils';
import { Quasar } from 'quasar';
import TestFunction from './TestFunction.vue';
import { createStore } from 'vuex';
import { createI18n } from 'vue-i18n';
import { nextTick } from 'vue';
// Mock dependencies
vi.mock('@/composables/useStreams', () => ({
default: () => ({
getStreams: vi.fn().mockResolvedValue({ list: [] }),
}),
}));
vi.mock('@/composables/useQuery', () => ({
default: () => ({
buildQueryPayload: vi.fn().mockReturnValue({ query: { sql: '' } }),
}),
}));
vi.mock('@/composables/useParser', () => ({
default: () => ({
sqlParser: vi.fn(() => Promise.resolve({})),
}),
}));
vi.mock('@/services/search', () => ({
default: {
search: vi.fn(),
},
}));
vi.mock('@/services/jstransform', () => ({
default: {
test: vi.fn(),
},
}));
vi.mock('@/utils/date', () => ({
getConsumableRelativeTime: vi.fn(),
}));
const mockStore = createStore({
state: {
theme: 'light',
selectedOrganization: {
identifier: 'test-org',
},
},
});
const mockI18n = createI18n({
locale: 'en',
messages: {
en: {
common: {
query: 'Query',
events: 'Events',
output: 'Output',
duration: 'Duration',
},
alerts: {
streamType: 'Stream Type',
stream_name: 'Stream Name',
},
search: {
runQuery: 'Run Query',
},
confirmDialog: {
loading: 'Loading',
},
},
},
});
describe('TestFunction.vue Branch Coverage', () => {
const defaultProps = {
vrlFunction: {
function: 'test vrl function',
name: 'testFunc',
},
heightOffset: 0,
};
beforeEach(() => {
vi.clearAllMocks();
});
describe('Core Branch Coverage Tests', () => {
it('should cover theme-based conditional branches', async () => {
const darkStore = createStore({
state: {
theme: 'dark', // Branch condition: === 'dark'
selectedOrganization: { identifier: 'test-org' },
},
});
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: darkStore,
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
// Branch: store.state.theme === 'dark' (multiple lines)
expect(wrapper.vm).toBeDefined();
expect((wrapper.vm as any).store.state.theme).toBe('dark');
});
it('should cover error message conditional branches', async () => {
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: mockStore,
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
const vm = wrapper.vm as any;
// Branch: !!sqlQueryErrorMsg (line 19)
vm.sqlQueryErrorMsg = 'SQL Error';
await nextTick();
expect(vm.sqlQueryErrorMsg).toBe('SQL Error');
// Branch: !sqlQueryErrorMsg
vm.sqlQueryErrorMsg = '';
expect(vm.sqlQueryErrorMsg).toBe('');
// Branch: !!eventsErrorMsg (line 196)
vm.eventsErrorMsg = 'Events Error';
expect(vm.eventsErrorMsg).toBe('Events Error');
// Branch: !!outputEventsErrorMsg (line 257)
vm.outputEventsErrorMsg = 'Output Error';
expect(vm.outputEventsErrorMsg).toBe('Output Error');
});
it('should cover loading state conditional branches', async () => {
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: mockStore,
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
const vm = wrapper.vm as any;
// Branch: loading.events = true (line 187)
vm.loading.events = true;
expect(vm.loading.events).toBe(true);
// Branch: loading.output = true (line 247)
vm.loading.output = true;
expect(vm.loading.output).toBe(true);
// Branch: disabled button condition (line 45)
vm.selectedStream = { name: '', type: 'logs' };
vm.inputQuery = '';
vm.loading.events = false;
// Test the button disabled condition
const isDisabled = !vm.selectedStream.name || !vm.inputQuery || vm.loading.events;
expect(isDisabled).toBe(true);
// Test enabled condition
vm.selectedStream.name = 'test_stream';
vm.inputQuery = 'SELECT * FROM test';
const isEnabled = vm.selectedStream.name && vm.inputQuery && !vm.loading.events;
expect(isEnabled).toBe(true);
});
it('should cover expand state conditional branches', async () => {
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: mockStore,
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
const vm = wrapper.vm as any;
// Branch: expandState.query (line 54)
vm.expandState.query = true;
expect(vm.expandState.query).toBe(true);
vm.expandState.query = false;
expect(vm.expandState.query).toBe(false);
// Branch: expandState.events (line 223)
vm.expandState.events = true;
expect(vm.expandState.events).toBe(true);
// Branch: expandState.output (line 275)
vm.expandState.output = true;
expect(vm.expandState.output).toBe(true);
});
it('should cover output message conditional branches', async () => {
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: mockStore,
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
const vm = wrapper.vm as any;
// Branch: !outputEvents.value (line 463)
vm.outputEvents = '';
expect(vm.outputMessage).toBe('Please click Test Function to see the events');
// Branch: outputEvents.value exists (line 467)
vm.outputEvents = '{"test": "data"}';
expect(vm.outputMessage).toBe('');
});
it('should cover data processing branches', async () => {
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: mockStore,
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
const vm = wrapper.vm as any;
// Branch: resetStream condition (line 517)
vm.selectedStream = { name: 'existing', type: 'logs' };
const resetStream = true;
if (resetStream) vm.selectedStream.name = '';
expect(vm.selectedStream.name).toBe('');
// Branch: !selectedStream.value.type (line 519)
vm.selectedStream.type = '';
const hasType = !!vm.selectedStream.type;
expect(hasType).toBe(false);
vm.selectedStream.type = 'logs';
expect(!!vm.selectedStream.type).toBe(true);
// Branch: dateTime type condition (line 542)
const dateTimeRelative = { type: 'relative', relativeTimePeriod: '1h' };
const dateTimeAbsolute = { type: 'absolute', startTime: new Date(), endTime: new Date() };
const isRelative = dateTimeRelative.type === 'relative';
expect(isRelative).toBe(true);
const isAbsolute = dateTimeAbsolute.type === 'relative';
expect(isAbsolute).toBe(false);
});
it('should cover input validation branches', async () => {
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: mockStore,
$q: { notify: vi.fn() },
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
const vm = wrapper.vm as any;
// Branch: !inputQuery.value (line 471)
vm.inputQuery = '';
const isEmpty = !vm.inputQuery;
expect(isEmpty).toBe(true);
// Branch: inputQuery exists (line 481)
vm.inputQuery = 'SELECT * FROM test';
const hasQuery = !!vm.inputQuery;
expect(hasQuery).toBe(true);
// Branch: JSON.parse throws error (line 598)
const invalidJson = 'invalid json{';
let isValidJson = false;
try {
JSON.parse(invalidJson);
isValidJson = true;
} catch (e) {
isValidJson = false;
expect(isValidJson).toBe(false);
}
// Branch: JSON.parse succeeds (line 596-597)
const validJson = '{"valid": "json"}';
try {
JSON.parse(validJson);
isValidJson = true;
} catch (e) {
isValidJson = false;
}
expect(isValidJson).toBe(true);
});
it('should cover filter functionality branches', async () => {
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: mockStore,
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
const vm = wrapper.vm as any;
const options = ['stream1', 'stream2', 'test_stream'];
const mockUpdate = vi.fn();
// Branch: val === "" (line 496)
vm.filterColumns(options, '', mockUpdate);
expect(mockUpdate).toHaveBeenCalled();
// Simulate the empty filter branch
let filteredOptions: any[] = [];
if ('' === '') {
filteredOptions = [...options];
}
expect(filteredOptions).toEqual(options);
// Branch: val !== "" (line 502-507)
const filterValue = 'test';
if (filterValue !== '') {
const value = filterValue.toLowerCase();
filteredOptions = options.filter(
(column: any) => column.toLowerCase().indexOf(value) > -1
);
}
expect(filteredOptions).toEqual(['test_stream']);
});
it('should cover error handling branches', async () => {
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: mockStore,
$q: { notify: vi.fn() },
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
const vm = wrapper.vm as any;
// Branch: error in getResults (line 577-582)
const err = { response: { data: { message: 'API Error' } } };
vm.sqlQueryErrorMsg = err.response?.data?.message ? err.response?.data?.message : 'Invalid SQL Query';
expect(vm.sqlQueryErrorMsg).toBe('API Error');
// Branch: handleTestError (line 631)
const errMsg = err.response?.data?.message || 'Error in testing function';
vm.outputEventsErrorMsg = 'Error while transforming results';
vm.outputEvents = errMsg;
expect(vm.outputEventsErrorMsg).toBe('Error while transforming results');
expect(vm.outputEvents).toBe('API Error');
// Branch: !isInputValid in testFunction (line 648-650)
const testInvalidJson = 'invalid json';
let testIsValid = false;
try {
JSON.parse(testInvalidJson);
testIsValid = true;
} catch (e) {
testIsValid = false;
// Branch: !isInputValid should return early
expect(testIsValid).toBe(false);
}
});
it('should cover line range and highlighting branches', async () => {
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: mockStore,
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
const vm = wrapper.vm as any;
// Branch: !outputEventsEditorRef.value (line 670)
vm.outputEventsEditorRef = null;
const result1 = vm.getLineRanges({ event: {}, message: 'error' });
expect(result1).toBeUndefined();
// Branch: line matching logic (lines 686-708)
vm.outputEventsEditorRef = {
getModel: () => ({
getLinesContent: () => ['{', ' "test": "data"', '}']
})
};
const testObject = { event: { test: 'data' }, message: 'Error message' };
const ranges = vm.getLineRanges(testObject);
expect(ranges).toBeDefined();
// Branch: errorEvents processing (line 728-741)
vm.originalOutputEvents = JSON.stringify([
{ event: { test: 'data' }, message: 'Error in event' }
]);
vm.outputEventsEditorRef.addErrorDiagnostics = vi.fn();
vm.getLineRanges = vi.fn().mockReturnValue([{ startLine: 1, endLine: 3, error: 'Test error' }]);
vm.highlightSpecificEvent();
expect(vm.outputEventsErrorMsg).toBe('Failed to apply VRL Function on few events');
});
it('should cover utility function branches', async () => {
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: mockStore,
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
const vm = wrapper.vm as any;
// Test updateQuery (line 511-514)
vm.selectedStream = { name: 'test_stream', type: 'logs' };
vm.updateQuery();
expect(vm.inputQuery).toBe('SELECT * FROM "test_stream"');
expect(vm.expandState.query).toBe(true);
// Test updateDateTime (line 534-536)
const testDateTime = { type: 'relative', relativeTimePeriod: '2h' };
vm.updateDateTime(testDateTime);
expect(vm.dateTime).toEqual(testDateTime);
// Test sendToAiChat (line 750-752)
const testValue = 'test AI chat value';
vm.sendToAiChat(testValue);
expect(wrapper.emitted('sendToAiChat')).toBeTruthy();
expect(wrapper.emitted('sendToAiChat')?.[0]).toEqual([testValue]);
// Test processTestResults (line 609-628)
vm.highlightSpecificEvent = vi.fn();
const results = {
data: {
results: [
{ event: { test: 'data1' } },
{ events: { test: 'data2' } } // Test both event and events branches
]
}
};
await vm.processTestResults(results);
expect(vm.expandState.query).toBe(false);
expect(vm.expandState.output).toBe(true);
});
it('should cover edge case branches', async () => {
const wrapper = mount(TestFunction, {
props: defaultProps,
global: {
plugins: [Quasar, mockI18n],
provide: {
store: mockStore,
},
stubs: {
'query-editor': true,
'DateTime': true,
'FullViewContainer': true,
'O2AIContextAddBtn': true,
},
},
});
const vm = wrapper.vm as any;
// Branch: editorLine === "},") modification (line 694-696)
const testEditorLine = "},";
const modifiedLine = testEditorLine === "}," ? "}" : testEditorLine;
expect(modifiedLine).toBe("}");
// Branch: isMatch condition (line 704)
let isMatch = true;
const testCondition = true;
if (!testCondition) {
isMatch = false;
}
expect(isMatch).toBe(true);
// Branch: startLine !== -1 (line 711)
const startLine = 0; // Found match
if (startLine !== -1) {
const endLine = startLine + 3;
expect(endLine).toBe(3);
}
// Branch: event.event || event.events (line 615)
const eventWithEvent = { event: { data: 'test' } };
const eventWithEvents = { events: { data: 'test' } };
const result1 = eventWithEvent.event || (eventWithEvent as any).events;
const result2 = (eventWithEvents as any).event || eventWithEvents.events;
expect(result1).toEqual({ data: 'test' });
expect(result2).toEqual({ data: 'test' });
});
});
});