-
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.
Merge pull request #92 from mitaai/blms/tests
#17 More tests
- Loading branch information
Showing
13 changed files
with
158 additions
and
8 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
20 changes: 20 additions & 0 deletions
20
src/components/Admin/User/AdminUserTable/AdminUserTable.test.js
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,20 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
import { render } from '@testing-library/react'; | ||
import AdminUserTable from './AdminUserTable'; | ||
import { user } from '../../../../utils/testUtil'; | ||
|
||
test('renders admin user view', async () => { | ||
const { getByTestId } = render( | ||
<AdminUserTable | ||
user={user} | ||
setAlerts={jest.fn} | ||
alerts={[]} | ||
isSelf | ||
/>, | ||
); | ||
const userTable = getByTestId('admin-user-view'); | ||
expect(userTable).toBeInTheDocument(); | ||
}); |
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
20 changes: 20 additions & 0 deletions
20
src/components/Dashboard/DashboardAnnotationList/DashboardAnnotationList.test.js
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,20 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
import { render } from '@testing-library/react'; | ||
import DashboardAnnotationList from './DashboardAnnotationList'; | ||
import { userSession } from '../../../utils/testUtil'; | ||
|
||
test('renders dashboard annotation list', async () => { | ||
const { getByTestId } = render( | ||
<DashboardAnnotationList | ||
session={userSession} | ||
alerts={[]} | ||
setAlerts={jest.fn} | ||
mode="dashboard" | ||
/>, | ||
); | ||
const annotationList = getByTestId('dash-annotation-list'); | ||
expect(annotationList).toBeInTheDocument(); | ||
}); |
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
19 changes: 19 additions & 0 deletions
19
src/components/Dashboard/DashboardDocumentList/DashboardDocumentList.test.js
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,19 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
import { render } from '@testing-library/react'; | ||
import DashboardDocumentList from './DashboardDocumentList'; | ||
import { userSession } from '../../../utils/testUtil'; | ||
|
||
test('renders dashboard document list', async () => { | ||
const { getByTestId } = render( | ||
<DashboardDocumentList | ||
session={userSession} | ||
alerts={[]} | ||
setAlerts={jest.fn} | ||
/>, | ||
); | ||
const documentList = getByTestId('dash-document-list'); | ||
expect(documentList).toBeInTheDocument(); | ||
}); |
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
17 changes: 17 additions & 0 deletions
17
src/components/Dashboard/DashboardGroupList/DashboardGroupList.test.js
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,17 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
import { render } from '@testing-library/react'; | ||
import DashboardGroupList from './DashboardGroupList'; | ||
import { userSession } from '../../../utils/testUtil'; | ||
|
||
test('renders dashboard group list', async () => { | ||
const { getByTestId } = render( | ||
<DashboardGroupList | ||
session={userSession} | ||
/>, | ||
); | ||
const groupList = getByTestId('dash-group-list'); | ||
expect(groupList).toBeInTheDocument(); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
import { render } from '@testing-library/react'; | ||
import SecondNavbar from './SecondNavbar'; | ||
import { userSession } from '../../utils/testUtil'; | ||
|
||
test('renders second navbar with type = dashboard', async () => { | ||
const { getByTestId } = render( | ||
<SecondNavbar | ||
session={userSession} | ||
type="dashboard" | ||
/>, | ||
); | ||
const navbar = getByTestId('second-navbar'); | ||
expect(navbar).toBeInTheDocument(); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
import { render } from '@testing-library/react'; | ||
import SlateToolbar from './SlateToolbar'; | ||
|
||
jest.mock('slate-react', () => ({ | ||
useSlate() { | ||
return {}; | ||
}, | ||
})); | ||
|
||
jest.mock('../../utils/slateUtil', () => ({ | ||
BlockButton() { return <div />; }, | ||
MarkButton() { return <div />; }, | ||
videoURLtoEmbedURL: jest.fn, | ||
insertVideoEmbed: jest.fn, | ||
})); | ||
|
||
jest.mock('@udecode/slate-plugins', () => ({ | ||
ToolbarImage() { return <div />; }, | ||
ToolbarAlign() { return <div />; }, | ||
ToolbarButton() { return <div />; }, | ||
ToolbarList() { return <div />; }, | ||
ToolbarLink() { return <div />; }, | ||
isNodeTypeIn: jest.fn, | ||
toggleNodeType: jest.fn, | ||
DEFAULTS_ALIGN: { | ||
align_left: { type: 'align_left' }, | ||
align_center: { type: 'align_center' }, | ||
align_right: { type: 'align_right' }, | ||
}, | ||
DEFAULTS_BLOCKQUOTE: { blockquote: { type: 'blockquote' } }, | ||
DEFAULTS_CODE_BLOCK: { code_block: { type: 'code_block' } }, | ||
DEFAULTS_HEADING: { | ||
h1: { type: 'h1' }, | ||
h2: { type: 'h2' }, | ||
h3: { type: 'h3' }, | ||
h4: { type: 'h4' }, | ||
h5: { type: 'h5' }, | ||
h6: { type: 'h6' }, | ||
}, | ||
DEFAULTS_IMAGE: {}, | ||
DEFAULTS_LINK: {}, | ||
DEFAULTS_LIST: { ul: { type: 'ul' }, ol: { type: 'ol' } }, | ||
ELEMENT_MEDIA_EMBED: 'media_embed', | ||
})); | ||
|
||
test('renders slate toolbar', async () => { | ||
const { getByTestId } = render( | ||
<SlateToolbar />, | ||
); | ||
const toolbar = getByTestId('slate-toolbar'); | ||
expect(toolbar).toBeInTheDocument(); | ||
}); |
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