From c1fb9fdda3aa5554c06df5ed002bf3422f2b5b47 Mon Sep 17 00:00:00 2001 From: Denis CHernov Date: Thu, 23 Jul 2026 09:48:22 -0700 Subject: [PATCH] use grpc transport bool for bridge pages --- src/components/Form/BridgeForm.test.tsx | 39 +++++++++++++++++++ src/components/Form/BridgeForm.tsx | 18 ++++++++- src/screens/Bridge/BridgeCard.test.tsx | 1 + src/screens/Bridge/BridgeCard.tsx | 7 ++++ src/screens/Bridge/BridgeView.tsx | 1 + .../EditBridge/EditBridgeScreen.test.tsx | 3 ++ .../EditBridge/EditBridgeView.test.tsx | 1 + src/screens/EditBridge/EditBridgeView.tsx | 1 + .../NewBridge/NewBridgeScreen.test.tsx | 2 + src/screens/NewBridge/NewBridgeView.test.tsx | 1 + src/screens/NewBridge/NewBridgeView.tsx | 1 + support/factories/gql/fetchBridge.ts | 1 + 12 files changed, 75 insertions(+), 1 deletion(-) diff --git a/src/components/Form/BridgeForm.test.tsx b/src/components/Form/BridgeForm.test.tsx index 485d503d..402afcf9 100644 --- a/src/components/Form/BridgeForm.test.tsx +++ b/src/components/Form/BridgeForm.test.tsx @@ -15,6 +15,7 @@ describe('BridgeForm', () => { url: '', minimumContractPayment: '0', confirmations: 0, + useConnectionManager: false, } render( @@ -38,6 +39,7 @@ describe('BridgeForm', () => { url: '', minimumContractPayment: '0', confirmations: 0, + useConnectionManager: false, } render( @@ -59,6 +61,7 @@ describe('BridgeForm', () => { url: '', minimumContractPayment: '0', confirmations: 0, + useConnectionManager: false, } render( @@ -92,9 +95,45 @@ describe('BridgeForm', () => { url: 'https://www.test.com', minimumContractPayment: '1', confirmations: 2, + useConnectionManager: false, }, expect.anything(), ), ) }) + + it('submits useConnectionManager when checked', async () => { + const handleSubmit = jest.fn() + const initialValues: FormValues = { + name: '', + url: '', + minimumContractPayment: '0', + confirmations: 0, + useConnectionManager: false, + } + + render( + , + ) + + userEvent.type(getByRole('textbox', { name: /name */i }), 'bridge1') + userEvent.type( + getByRole('textbox', { name: /bridge url */i }), + 'https://www.test.com', + ) + userEvent.click(getByRole('checkbox', { name: /use grpc transport/i })) + + userEvent.click(getByRole('button', { name: /submit/i })) + + await waitFor(() => + expect(handleSubmit).toHaveBeenCalledWith( + expect.objectContaining({ useConnectionManager: true }), + expect.anything(), + ), + ) + }) }) diff --git a/src/components/Form/BridgeForm.tsx b/src/components/Form/BridgeForm.tsx index 2c270252..1f9ed402 100644 --- a/src/components/Form/BridgeForm.tsx +++ b/src/components/Form/BridgeForm.tsx @@ -1,7 +1,10 @@ import React from 'react' import { Field, Form, Formik, FormikHelpers } from 'formik' -import { FormikTextField as TextField } from './FormikFields' +import { + FormikTextField as TextField, + FormikCheckboxWithLabel as CheckboxWithLabel, +} from './FormikFields' import * as Yup from 'yup' import Button from '@mui/material/Button' @@ -12,6 +15,7 @@ export interface FormValues { minimumContractPayment: string confirmations: number url: string + useConnectionManager: boolean } const ValidationSchema = Yup.object().shape({ @@ -105,6 +109,18 @@ export const BridgeForm = ({ + + + +