Skip to content

Commit

Permalink
remove duplicate tests
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Chalabi <[email protected]>
  • Loading branch information
chalabi2 committed Sep 1, 2024
1 parent 6ff8755 commit 7bc853e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
2 changes: 1 addition & 1 deletion components/groups/forms/groups/MemberInfoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { isValidAddress } from '@/utils/string';

const MemberSchema = Yup.object().shape({
address: Yup.string()
.test('is-valid-address', 'Invalid address format', isValidAddress)
.test('is-valid-address', 'Invalid address format', value => isValidAddress(value || ''))
.required('Required'),
name: Yup.string().required('Required'),
weight: Yup.number().min(1, 'Must be at least 1').required('Required'),
Expand Down
19 changes: 0 additions & 19 deletions components/groups/forms/groups/__tests__/MemberInfoForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,6 @@ describe('MemberInfoForm Component', () => {
});
});

test('validates address format', async () => {
renderWithChainProvider(<MemberInfoForm {...mockProps} />);
const addressInput = screen.getAllByLabelText('Address')[0] as HTMLInputElement;

fireEvent.change(addressInput, { target: { value: 'invalid_address' } });
fireEvent.blur(addressInput);

await new Promise(resolve => setTimeout(resolve, 0));

expect(addressInput).toHaveAttribute('aria-invalid', 'true');

fireEvent.change(addressInput, { target: { value: 'manifest1validaddress' } });
fireEvent.blur(addressInput);

await new Promise(resolve => setTimeout(resolve, 0));

expect(addressInput).not.toHaveAttribute('aria-invalid', 'true');
});

test('next button is disabled when address is invalid', async () => {
const invalidFormData = {
...mockGroupFormData,
Expand Down

0 comments on commit 7bc853e

Please sign in to comment.