diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..8affc953ba --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,24 @@ +name: Build + +on: pull_request + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up NodeJS + uses: actions/setup-node@v4 + with: + node-version: 'lts/Iron' + check-latest: true + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build diff --git a/src/views/manualAccount/ManualAccountForm-test.tsx b/src/views/manualAccount/ManualAccountForm-test.tsx index 302401df62..a9efee2c8d 100644 --- a/src/views/manualAccount/ManualAccountForm-test.tsx +++ b/src/views/manualAccount/ManualAccountForm-test.tsx @@ -19,6 +19,7 @@ const accountTypeButtonName: Record = { [AccountTypes.SAVINGS]: 'Savings', [AccountTypes.LOAN]: 'Loan', [AccountTypes.CREDIT_CARD]: 'Credit Card', + [AccountTypes.PROPERTY]: 'Property', } const buildMockApi = (apiOverrides: Partial = {}) => ({ @@ -111,6 +112,17 @@ describe('', () => { expect(screen.getByLabelText(/interest rate/i)).toBeInTheDocument() }) + + it('renders the property type select field and allows selecting a value', async () => { + const { user } = await renderManualAccountForm({ accountType: AccountTypes.PROPERTY }) + + expect(screen.getByLabelText(/property type/i)).toBeInTheDocument() + + await user.click(screen.getByLabelText(/property type/i)) + await user.click(await screen.findByRole('option', { name: 'Vehicle' })) + + expect(screen.getByRole('combobox', { name: /property type/i })).toHaveTextContent('Vehicle') + }) }) describe('Personal and Business Selection', () => { @@ -172,6 +184,18 @@ describe('', () => { expect((await screen.findAllByText(/is required/i)).length).toBeGreaterThan(0) expect(mockApi.createAccount).not.toHaveBeenCalled() }) + + it('shows a required error for property type when saving without selecting a value', async () => { + const { user, mockApi } = await renderManualAccountForm({ + accountType: AccountTypes.PROPERTY, + }) + + await user.type(screen.getByLabelText(/account name/i), 'My Property') + await user.click(screen.getByTestId('save-manual-account-button')) + + expect(await screen.findByText('Property type is required')).toBeInTheDocument() + expect(mockApi.createAccount).not.toHaveBeenCalled() + }) }) describe('Form Submission', () => { diff --git a/src/views/manualAccount/ManualAccountForm.tsx b/src/views/manualAccount/ManualAccountForm.tsx index 645cc31f77..52d144dfd4 100644 --- a/src/views/manualAccount/ManualAccountForm.tsx +++ b/src/views/manualAccount/ManualAccountForm.tsx @@ -9,10 +9,11 @@ import _startsWith from 'lodash/startsWith' import _isEmpty from 'lodash/isEmpty' import Button from '@mui/material/Button' +import MenuItem from '@mui/material/MenuItem' import { Text } from '@mxenabled/mxui' import { MessageBox } from '@kyper/messagebox' import { useTokens } from '@kyper/tokenprovider' -import { Select, SelectionBox, TextField } from 'src/privacy/input' +import { SelectionBox, TextField } from 'src/privacy/input' import { __ } from 'src/utilities/Intl' import { fadeOut } from 'src/utilities/Animation' @@ -307,15 +308,24 @@ export const ManualAccountForm = React.forwardRef -