fix tests
This commit is contained in:
parent
8c06286607
commit
16916fd006
|
|
@ -71,9 +71,6 @@ export default {
|
|||
return this.players.filter(player => player.name.includes(this.search))
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.fetchList()
|
||||
},
|
||||
methods: {
|
||||
async fetchList() {
|
||||
this.players = (await this.$http.get('/user/player/list')).data
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ test('submit applying texture', async () => {
|
|||
Vue.prototype.$http.get.mockResolvedValue({ data: [{ pid: 1, name: 'a' }] })
|
||||
Vue.prototype.$http.post.mockResolvedValueOnce({ code: 1 })
|
||||
.mockResolvedValue({ code: 0, message: 'ok' })
|
||||
const wrapper = mount(ApplyToPlayerDialog)
|
||||
await flushPromises()
|
||||
const wrapper = mount<Vue & { fetchList(): Promise<void> }>(ApplyToPlayerDialog)
|
||||
await wrapper.vm.fetchList()
|
||||
const button = wrapper.find('.btn-outline-info')
|
||||
|
||||
button.trigger('click')
|
||||
|
|
@ -50,8 +50,8 @@ test('compute avatar URL', () => {
|
|||
|
||||
test('search players', async () => {
|
||||
Vue.prototype.$http.get.mockResolvedValue({ data: [{ pid: 1, name: 'abc' }] })
|
||||
const wrapper = mount(ApplyToPlayerDialog)
|
||||
await flushPromises()
|
||||
const wrapper = mount<Vue & { fetchList(): Promise<void> }>(ApplyToPlayerDialog)
|
||||
await wrapper.vm.fetchList()
|
||||
|
||||
wrapper.find('input').setValue('e')
|
||||
expect(wrapper.find('.btn-outline-info').exists()).toBeFalse()
|
||||
|
|
|
|||
|
|
@ -209,10 +209,9 @@ test('apply texture', async () => {
|
|||
|
||||
button.trigger('click')
|
||||
await flushPromises()
|
||||
expect(wrapper.find('input[type="radio"]').attributes('value')).toBe('1')
|
||||
expect(wrapper.find('.model-label > img').attributes('src')).toBe('/avatar/10?3d&size=35')
|
||||
expect(wrapper.find('.modal-body').text()).toContain('name')
|
||||
jest.runAllTimers()
|
||||
expect(wrapper.find('.btn-outline-info').text()).toContain('name')
|
||||
expect(wrapper.find('.btn-outline-info > img').attributes('src'))
|
||||
.toBe('/avatar/10?3d&size=45')
|
||||
})
|
||||
|
||||
test('reset selected texture', () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user