-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reuse dropdown and add test for addautocomplete
- Loading branch information
1 parent
17a6c34
commit 4c31c7a
Showing
8 changed files
with
76 additions
and
80 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
src/components/UI/Form/AddAutoComplete/AddAutoComplete.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { MockedProvider } from '@apollo/client/testing'; | ||
import { render } from '@testing-library/react'; | ||
import { AddAutoComplete } from './AddAutoComplete'; | ||
import { CREATE_LABEL } from 'graphql/mutations/Tags'; | ||
describe('<AddAutoComplete />', () => { | ||
const mocks = [ | ||
{ | ||
request: { | ||
query: CREATE_LABEL, | ||
}, | ||
result: { | ||
data: { | ||
addAutoComplete: { | ||
id: 1, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; | ||
const option: any[] = [ | ||
{ | ||
description: null, | ||
id: '1', | ||
label: 'Messages', | ||
}, | ||
]; | ||
|
||
const mockHandleChange = vi.fn(); | ||
const defaultProps = { | ||
label: 'Example', | ||
options: option, | ||
optionLabel: 'label', | ||
onChange: mockHandleChange, | ||
field: { name: 'example', value: [] }, | ||
form: { dirty: false, touched: false, errors: false, setFieldValue: mockHandleChange }, | ||
}; | ||
|
||
it('renders <AddAutoComplete /> component', () => { | ||
const wrapper = render( | ||
<MockedProvider mocks={mocks}> | ||
<AddAutoComplete {...defaultProps} /> | ||
</MockedProvider> | ||
); | ||
expect(wrapper).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.Input { | ||
display: flex; | ||
padding: 8px 0px; | ||
min-width: 180px; | ||
} | ||
|
||
.Input label { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,10 @@ export const GET_INTERACTIVE_MESSAGE = gql` | |
id | ||
label | ||
} | ||
tag { | ||
id | ||
label | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters