Update test
This commit is contained in:
parent
f43ce12a87
commit
d3abbcdf82
@ -69,7 +69,7 @@ export default {
|
||||
value ? resolve() : reject(this.$t('skinlib.emptyNewTextureName'));
|
||||
}))
|
||||
});
|
||||
} catch (error) {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ export default {
|
||||
type: 'warning',
|
||||
showCancelButton: true
|
||||
});
|
||||
} catch (error) {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ export default {
|
||||
type: 'question',
|
||||
showCancelButton: true
|
||||
});
|
||||
} catch (error) {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,8 @@ test('rename texture', async () => {
|
||||
axios.post
|
||||
.mockResolvedValueOnce({ data: { errno: 0 } })
|
||||
.mockResolvedValueOnce({ data: { errno: 1 } });
|
||||
swal.mockImplementation(async options => {
|
||||
swal.mockImplementationOnce(() => Promise.reject())
|
||||
.mockImplementation(async options => {
|
||||
options.inputValidator('name');
|
||||
options.inputValidator().catch(() => {});
|
||||
return 'new-name';
|
||||
@ -54,6 +55,10 @@ test('rename texture', async () => {
|
||||
const wrapper = mount(ClosetItem, { propsData: factory() });
|
||||
const button = wrapper.findAll('.dropdown-menu > li').at(0).find('a');
|
||||
|
||||
button.trigger('click');
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(axios.post).not.toBeCalled();
|
||||
|
||||
button.trigger('click');
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
@ -71,11 +76,15 @@ test('remove texture', async () => {
|
||||
axios.post
|
||||
.mockResolvedValueOnce({ data: { errno: 0 } })
|
||||
.mockResolvedValueOnce({ data: { errno: 1 } });
|
||||
swal.mockResolvedValue();
|
||||
swal.mockRejectedValueOnce().mockResolvedValue();
|
||||
|
||||
const wrapper = mount(ClosetItem, { propsData: factory() });
|
||||
const button = wrapper.findAll('.dropdown-menu > li').at(1).find('a');
|
||||
|
||||
button.trigger('click');
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(axios.post).not.toBeCalled();
|
||||
|
||||
button.trigger('click');
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
@ -91,7 +100,7 @@ test('set as avatar', async () => {
|
||||
axios.post
|
||||
.mockResolvedValueOnce({ data: { errno: 0 } })
|
||||
.mockResolvedValueOnce({ data: { errno: 1 } });
|
||||
swal.mockResolvedValue();
|
||||
swal.mockRejectedValueOnce().mockResolvedValue();
|
||||
window.$ = jest.fn(() => ({
|
||||
each(fn) { fn(); },
|
||||
prop() {},
|
||||
@ -101,6 +110,10 @@ test('set as avatar', async () => {
|
||||
const wrapper = mount(ClosetItem, { propsData: factory() });
|
||||
const button = wrapper.findAll('.dropdown-menu > li').at(2).find('a');
|
||||
|
||||
button.trigger('click');
|
||||
await wrapper.vm.$nextTick();
|
||||
expect(axios.post).not.toBeCalled();
|
||||
|
||||
button.trigger('click');
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user