Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37821 - Fix RegistrationCommandsPage tests #10320

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions webpack/assets/javascripts/react_app/mockRequests.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';
import { MockAdapter } from '@theforeman/test';

export const mock = () => new MockAdapter(axios);
export const mock = new MockAdapter(axios);
const methods = {
GET: 'onGet',
POST: 'onPost',
Expand All @@ -15,9 +15,6 @@ export const mockRequest = ({
data = null,
status = 200,
response = null,
}) =>
mock()
[methods[method]](url, data)
.reply(status, response);
}) => mock[methods[method]](url, data).reply(status, response);

export const mockReset = () => mock().reset();
export const mockReset = () => mock.reset();
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
/* eslint-disable promise/prefer-await-to-then */
import { submitForm } from './forms';
import { mockReset } from '../../../mockRequests';

describe('form actions', () => {
beforeEach(() => {
document.head.innerHTML = `<meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="token123" />`;
});
afterEach(() => {
mockReset();
});

it('SubmitForm must include an object item/values', () => {
expect(() => {
Expand Down
Loading