-
Notifications
You must be signed in to change notification settings - Fork 664
Closed
Description
Version
1.0.0-beta.31
Reproduction link
https://jsfiddle.net/3uyr91bj/
Steps to reproduce
In my vuex action, I change location window object.
I have action with change location:
async setForm({ rootState, state, commit, dispatch }, formData) {
...
switch (answ.result.type) {
...
case 'redirect':
console.log(answ.data.url);
window.location = answ.data.url;
console.log({ location: window.location.href });
break;
default:
break;
My test function
it('setForm - success, redirect', async done => {
const formData = {
status: 'success',
result: {
type: 'redirect',
data: {
url: 'https://www.google.ru/'
}
}
};
await store.dispatch(
'deposit/setForm',
formData,
{ root: true }
);
// delay for change location
await new Promise(resolve => {
setTimeout(() => { resolve(true); }, 1000);
});
expect(window.location.href).toBe('https://www.google.ru/');
});
But, My location din't change.
expect(received).toBe(expected) // Object.is equality
Expected: "https://www.google.ru/"
Received: "http://localhost/"
How to change location and tests it ?
What is expected?
Location is 'https://www.google.ru/'
What is actually happening?
Location is 'http://localhost/'
Metadata
Metadata
Assignees
Labels
No labels