This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/main by this push:
new 07ca5d4cd6 test(frontend): add unit tests for RowModalComponent (#5580)
07ca5d4cd6 is described below
commit 07ca5d4cd6efebf2de284a599db1e88f2a778c08
Author: Neil Ketteringham <[email protected]>
AuthorDate: Tue Jun 9 15:35:42 2026 -0700
test(frontend): add unit tests for RowModalComponent (#5580)
### What changes were proposed in this PR?
This PR adds a comprehensive unit test suite
(`result-panel-modal.component.spec.ts`) for the `RowModalComponent`.
The newly introduced test cases verify that:
* The component instantiates successfully with injection tokens mapped
correctly (`NZ_MODAL_DATA`, `NzModalRef`).
* The lifecycle method `ngOnChanges()` executes smoothly to resolve
nested service streams through `WorkflowResultService` and
`PanelResizeService`.
* The internal property `currentDisplayRowData` is accurately populated
with target row values evaluated from mock RxJS data streams.
### Any related issues, documentation, discussions?
Closes #5469
### How was this PR tested?
This PR was tested by executing the newly added unit test suite
(`result-panel-modal.component.spec.ts`) to ensure all assertions pass
successfully, validating both the dependency injection setup and the
reactive stream logic.
### Was this PR authored or co-authored using generative AI tooling?
No
---
.../result-panel-modal.component.spec.ts | 68 ++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git
a/frontend/src/app/workspace/component/result-panel/result-panel-modal.component.spec.ts
b/frontend/src/app/workspace/component/result-panel/result-panel-modal.component.spec.ts
new file mode 100644
index 0000000000..8d7e1cc8f9
--- /dev/null
+++
b/frontend/src/app/workspace/component/result-panel/result-panel-modal.component.spec.ts
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { ComponentFixture, TestBed } from "@angular/core/testing";
+import { RowModalComponent } from "./result-panel-modal.component";
+import { PanelResizeService } from
"../../service/workflow-result/panel-resize/panel-resize.service";
+import { WorkflowResultService } from
"../../service/workflow-result/workflow-result.service";
+import { NZ_MODAL_DATA, NzModalRef } from "ng-zorro-antd/modal";
+import { of } from "rxjs";
+
+describe("RowModalComponent", () => {
+ let component: RowModalComponent;
+ let fixture: ComponentFixture<RowModalComponent>;
+
+ const mockTupleResult = { tuple: { id: "123", value: "test_data" } };
+ const workflowResultServiceSpy = {
+ getPaginatedResultService: vi.fn().mockReturnValue({
+ selectTuple: vi.fn().mockReturnValue(of(mockTupleResult)),
+ }),
+ };
+
+ const resizeServiceSpy = {
+ pageSize: 10,
+ };
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [RowModalComponent],
+ providers: [
+ { provide: NZ_MODAL_DATA, useValue: { operatorId: "op-1", rowIndex: 3
} },
+ { provide: NzModalRef, useValue: { getConfig: () => ({}), close:
vi.fn() } },
+ { provide: WorkflowResultService, useValue: workflowResultServiceSpy },
+ { provide: PanelResizeService, useValue: resizeServiceSpy },
+ ],
+ }).compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(RowModalComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it("should create", () => {
+ expect(component).toBeTruthy();
+ });
+
+ it("should populate row data on ngOnChanges", () => {
+ component.ngOnChanges();
+ expect(component.currentDisplayRowData).toEqual(mockTupleResult.tuple);
+ });
+});