foreman icon indicating copy to clipboard operation
foreman copied to clipboard

Fixes #37821 - Fix RegistrationCommandsPage tests

Open MariaAga opened this issue 1 year ago • 3 comments

export const mock = () => new MockAdapter(axios); was moved to be a function because it caused webpack issues, but we exclude this file from ExportAll. There should only be one MockAdapter. one of the issues of having multiple instances of the mockAdapter is this error:

        throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : "When called with an action of type " + (actionType ? "\"" + String(actionType) + "\"" : '(unknown type)') + ", the slice reducer for key \"" + _key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined.");
              ^

Error: When called with an action of type "REGISTRATION_COMMANDS_FAILURE", the slice reducer for key "reducerSpy" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.

webpack/assets/javascripts/react_app/redux/actions/common/forms.test.js didnt use mocks anymore so it doesnt need to reset them.

MariaAga avatar Sep 13 '24 16:09 MariaAga

I wouldnt CP it as it cant positively affect the application it self, this is only for tests

MariaAga avatar Sep 13 '24 16:09 MariaAga

Fair enough. This was causing you issues when you started to upgrade libraries?

ekohl avatar Sep 13 '24 20:09 ekohl

Fair enough. This was causing you issues when you started to upgrade libraries?

This was more noticeable when other tests were failing and I was looking into errors in tests, also had it fail once when running but not another time :shrug:

MariaAga avatar Sep 16 '24 12:09 MariaAga

Need to also fix integration test for this page

MariaAga avatar Mar 18 '25 14:03 MariaAga

does it make sense to squash them? they're doing pretty different things

MariaAga avatar Mar 28 '25 12:03 MariaAga

@ofedoren could you please merge it?

kmalyjur avatar Apr 02 '25 12:04 kmalyjur