forked from taniarascia/takenote
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testing a component of setting modal (taniarascia#465)
Co-authored-by: Tania Rascia <[email protected]>
- Loading branch information
1 parent
50b7705
commit 940a9f3
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
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
38 changes: 38 additions & 0 deletions
38
tests/unit/client/components/SettingsModal/IconButton.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,38 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react' | ||
import '@testing-library/jest-dom' | ||
import 'jest-extended' | ||
import { Camera } from 'react-feather' | ||
|
||
import { TestID } from '@resources/TestID' | ||
import { IconButton, IconButtonProps } from '@/components/SettingsModal/IconButton' | ||
|
||
describe('<IconButton />', () => { | ||
it('renders the IconButton component', () => { | ||
const enabledProps: IconButtonProps = { | ||
handler: jest.fn, | ||
dataTestID: TestID.ICON_BUTTON, | ||
icon: Camera, | ||
text: 'takeNote', | ||
} | ||
|
||
const component = render(<IconButton {...enabledProps} />) | ||
|
||
expect(component).toBeTruthy() | ||
}) | ||
|
||
it('renders the IconButton component as disabled', () => { | ||
const disabledProps: IconButtonProps = { | ||
handler: jest.fn, | ||
dataTestID: TestID.ICON_BUTTON, | ||
disabled: true, | ||
icon: Camera, | ||
text: 'takeNote', | ||
} | ||
|
||
const component = render(<IconButton {...disabledProps} />) | ||
const button = component.queryByTestId(TestID.ICON_BUTTON) | ||
|
||
expect(button).toBeDisabled() | ||
}) | ||
}) |
27 changes: 27 additions & 0 deletions
27
tests/unit/client/components/SettingsModal/IconButtonUploader.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,27 @@ | ||
import React from 'react' | ||
import { render } from '@testing-library/react' | ||
import '@testing-library/jest-dom' | ||
import 'jest-extended' | ||
import { Camera } from 'react-feather' | ||
|
||
import { TestID } from '@resources/TestID' | ||
import { | ||
IconButtonUploader, | ||
IconButtonUploaderProps, | ||
} from '@/components/SettingsModal/IconButtonUploader' | ||
|
||
describe('<IconButtonUploader />', () => { | ||
it('renders the IconButtonUploader component', () => { | ||
const enabledProps: IconButtonUploaderProps = { | ||
handler: jest.fn, | ||
dataTestID: TestID.ICON_BUTTON_UPLOADER, | ||
icon: Camera, | ||
text: 'takeNote', | ||
accept: 'takeNote', | ||
} | ||
|
||
const component = render(<IconButtonUploader {...enabledProps} />) | ||
|
||
expect(component).toBeTruthy() | ||
}) | ||
}) |