Fix risky test
This commit is contained in:
parent
767436610c
commit
d657e88dd8
|
|
@ -346,8 +346,7 @@ export default {
|
||||||
inputValue: player.player_name,
|
inputValue: player.player_name,
|
||||||
input: 'text',
|
input: 'text',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
inputValidator: /* istanbul ignore next */ value =>
|
inputValidator: value => !value && this.$t('user.emptyPlayerName')
|
||||||
!value && this.$t('user.emptyPlayerName')
|
|
||||||
});
|
});
|
||||||
if (dismiss) {
|
if (dismiss) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,14 @@ test('change player name', async () => {
|
||||||
Vue.prototype.$http.post
|
Vue.prototype.$http.post
|
||||||
.mockResolvedValueOnce({ errno: 1 })
|
.mockResolvedValueOnce({ errno: 1 })
|
||||||
.mockResolvedValue({ errno: 0 });
|
.mockResolvedValue({ errno: 0 });
|
||||||
swal.mockResolvedValueOnce({ dismiss: 1 })
|
swal.mockImplementationOnce(() => ({ dismiss: 1 }))
|
||||||
.mockResolvedValue({ value: 'new-name' });
|
.mockImplementation(({ inputValidator }) => {
|
||||||
|
if (inputValidator) {
|
||||||
|
inputValidator();
|
||||||
|
inputValidator('new-name');
|
||||||
|
return { value: 'new-name' };
|
||||||
|
}
|
||||||
|
});
|
||||||
const wrapper = mount(Players);
|
const wrapper = mount(Players);
|
||||||
await wrapper.vm.$nextTick();
|
await wrapper.vm.$nextTick();
|
||||||
const button = wrapper.find('.btn-default');
|
const button = wrapper.find('.btn-default');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user