Skip to content

Commit

Permalink
updates test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSCorey committed Jun 28, 2022
1 parent 2147ac2 commit 218a3d3
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions awx/ui/src/components/LaunchButton/LaunchButton.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,48 +113,6 @@ describe('LaunchButton', () => {
expect(history.location.pathname).toEqual('/jobs/9000/output');
});

test('should disable button to prevent duplicate clicks', async () => {
WorkflowJobTemplatesAPI.readLaunch.mockResolvedValue({
data: {
can_start_without_user_input: true,
},
});
const history = createMemoryHistory({
initialEntries: ['/jobs/9000'],
});
WorkflowJobTemplatesAPI.launch.mockImplementation(async () => {
// return asynchronously so isLaunching isn't set back to false in the
// same tick
await new Promise((resolve) => setTimeout(resolve, 10));
return {
data: {
id: 9000,
},
};
});
const wrapper = mountWithContexts(
<LaunchButton
resource={{
id: 1,
type: 'workflow_job_template',
}}
>
{({ handleLaunch, isLaunching }) => (
<button type="submit" onClick={handleLaunch} disabled={isLaunching} />
)}
</LaunchButton>,
{
context: {
router: { history },
},
}
);
const button = wrapper.find('button');
await act(() => button.prop('onClick')());
wrapper.update();
expect(wrapper.find('button').prop('disabled')).toEqual(false);
});

test('should relaunch job correctly', async () => {
JobsAPI.readRelaunch.mockResolvedValue({
data: {
Expand Down

0 comments on commit 218a3d3

Please sign in to comment.