-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add tests for queue components
- Loading branch information
ismay
committed
Nov 2, 2023
1 parent
7a20811
commit db75603
Showing
6 changed files
with
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react' | ||
import { shallow, mount } from 'enzyme' | ||
import DeleteQueueAction from './DeleteQueueAction' | ||
|
||
describe('<DeleteQueueAction>', () => { | ||
it('renders without errors', () => { | ||
shallow(<DeleteQueueAction name="name" onSuccess={() => {}} />) | ||
}) | ||
|
||
it('shows the modal when MenuItem is clicked', () => { | ||
const wrapper = mount( | ||
<DeleteQueueAction name="name" onSuccess={() => {}} /> | ||
) | ||
|
||
expect(wrapper.find('DeleteQueueModal')).toHaveLength(0) | ||
|
||
wrapper.find('a').simulate('click') | ||
|
||
expect(wrapper.find('DeleteQueueModal')).toHaveLength(1) | ||
}) | ||
}) |
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,22 @@ | ||
import React from 'react' | ||
import { shallow, mount } from 'enzyme' | ||
import history from '../../services/history' | ||
import EditQueueAction from './EditQueueAction' | ||
|
||
jest.mock('../../services/history', () => ({ | ||
push: jest.fn(), | ||
})) | ||
|
||
describe('<EditQueueAction>', () => { | ||
it('renders without errors', () => { | ||
shallow(<EditQueueAction name="name" />) | ||
}) | ||
|
||
it('calls history.push correctly when MenuItem is clicked', () => { | ||
const wrapper = mount(<EditQueueAction name="name" />) | ||
|
||
wrapper.find('a').simulate('click') | ||
|
||
expect(history.push).toHaveBeenCalledWith('/queue/name') | ||
}) | ||
}) |
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,9 @@ | ||
import React from 'react' | ||
import { shallow } from 'enzyme' | ||
import QueueActions from './QueueActions' | ||
|
||
describe('<QueueActions>', () => { | ||
it('renders without errors', () => { | ||
shallow(<QueueActions name="1" refetch={() => {}} />) | ||
}) | ||
}) |
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,29 @@ | ||
import React from 'react' | ||
import { shallow } from 'enzyme' | ||
import QueueTableRow from './QueueTableRow' | ||
|
||
describe('<QueueTableRow>', () => { | ||
it('renders queues without errors', () => { | ||
const queue = { | ||
id: 'lnWRZN67iDU', | ||
name: 'Queue 1', | ||
cronExpression: '0 0 3 ? * MON', | ||
nextExecutionTime: '2021-03-01T03:00:00.000', | ||
status: 'SCHEDULED', | ||
enabled: true, | ||
configurable: true, | ||
sequence: [ | ||
{ | ||
id: 'lnWRZN67iDU', | ||
name: 'Job 1', | ||
type: 'DATA_INTEGRITY', | ||
cronExpression: '0 0 3 ? * MON', | ||
nextExecutionTime: '2021-03-01T03:00:00.000', | ||
status: 'SCHEDULED', | ||
}, | ||
], | ||
} | ||
|
||
shallow(<QueueTableRow queue={queue} refetch={() => {}} />) | ||
}) | ||
}) |
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