Vue component unit test isolation (#12154)
* Issue 10786 - Add unit test for Home component * Issue 10786 - Improve test setup and test invite parameter variations * Issue 10786 - Improve Vue.js test isolation by adding async keyword to dispatch function * Issue 10786 - Missing action does not need to be awaited * Use localVue for groupsUtilities test and revert partial zone fix
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
<div class="inner-content">
|
||||
<questDialogContent :item="item" />
|
||||
<div
|
||||
class="purchase-amount"
|
||||
v-if="!item.locked"
|
||||
class="purchase-amount"
|
||||
>
|
||||
<div class="how-many-to-buy">
|
||||
<strong>{{ $t('howManyToBuy') }}</strong>
|
||||
|
||||
@@ -913,6 +913,7 @@ export default {
|
||||
if (username.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$store.dispatch('auth:verifyUsername', {
|
||||
username: this.username,
|
||||
}).then(res => {
|
||||
@@ -942,15 +943,7 @@ export default {
|
||||
groupInvite,
|
||||
});
|
||||
|
||||
let redirectTo;
|
||||
|
||||
if (this.$route.query.redirectTo) {
|
||||
redirectTo = this.$route.query.redirectTo;
|
||||
} else {
|
||||
redirectTo = '/';
|
||||
}
|
||||
|
||||
window.location.href = redirectTo;
|
||||
window.location.href = this.$route.query.redirectTo || '/';
|
||||
},
|
||||
playButtonClick () {
|
||||
Analytics.track({
|
||||
@@ -968,7 +961,7 @@ export default {
|
||||
} else {
|
||||
try {
|
||||
await hello(network).logout();
|
||||
} catch (e) {} // eslint-disable-line
|
||||
} catch (e) {} // eslint-disable-line
|
||||
|
||||
const redirectUrl = `${window.location.protocol}//${window.location.host}`;
|
||||
const auth = await hello(network).login({
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
>
|
||||
<div
|
||||
class="svg-icon color"
|
||||
v-html="icons.pin">
|
||||
v-html="icons.pin"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -60,7 +60,7 @@ export function mapActions (actions) {
|
||||
const res = {};
|
||||
|
||||
normalizeMap(actions).forEach(({ key, val }) => {
|
||||
res[key] = function mappedAction (...args) {
|
||||
res[key] = async function mappedAction (...args) {
|
||||
return this.$store.dispatch.apply(this.$store, [val].concat(args)); // eslint-disable-line prefer-spread, max-len
|
||||
};
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@ export default class Store {
|
||||
|
||||
// Actions should be called using store.dispatch(ACTION_NAME, ...ARGS)
|
||||
// They get passed the store instance and any additional argument passed to dispatch()
|
||||
dispatch (type, ...args) {
|
||||
async dispatch (type, ...args) {
|
||||
const action = this._actions[type];
|
||||
|
||||
if (!action) throw new Error(`Action "${type}" not found.`);
|
||||
|
||||
Reference in New Issue
Block a user