Test cases for #61
This commit is contained in:
parent
1269fdaa82
commit
b4ab63907c
@ -38,7 +38,7 @@ test('button for adding to closet should be disabled if not auth', () => {
|
||||
expect(wrapper.find(Button).attributes('disabled')).toBe('disabled')
|
||||
})
|
||||
|
||||
test('button for adding to closet should be disabled if auth', () => {
|
||||
test('button for adding to closet should be enabled if auth', () => {
|
||||
Vue.prototype.$http.get.mockResolvedValue({ data: {} })
|
||||
Object.assign(window.blessing.extra, { inCloset: true, currentUid: 1 })
|
||||
const wrapper = mount(Show, {
|
||||
@ -132,6 +132,28 @@ test('operation panel should not be rendered if not auth', () => {
|
||||
expect(wrapper.find('.box-warning').exists()).toBeFalse()
|
||||
})
|
||||
|
||||
test('operation panel should not be rendered if not privileged', () => {
|
||||
Object.assign(window.blessing.extra, { currentUid: 2 })
|
||||
Vue.prototype.$http.get.mockResolvedValue({ data: { uploader: 1 } })
|
||||
const wrapper = mount(Show, {
|
||||
mocks: {
|
||||
$route: ['/skinlib/show/1', '1'],
|
||||
},
|
||||
})
|
||||
expect(wrapper.find('.box-warning').exists()).toBeFalse()
|
||||
})
|
||||
|
||||
test('operation panel should be rendered if privileged', () => {
|
||||
Object.assign(window.blessing.extra, { currentUid: 1 })
|
||||
Vue.prototype.$http.get.mockResolvedValue({ data: { uploader: 1 } })
|
||||
const wrapper = mount(Show, {
|
||||
mocks: {
|
||||
$route: ['/skinlib/show/1', '1'],
|
||||
},
|
||||
})
|
||||
expect(wrapper.find('.box-warning').exists()).toBeTrue()
|
||||
})
|
||||
|
||||
test('download texture', async () => {
|
||||
Object.assign(window.blessing.extra, { currentUid: 1 })
|
||||
Vue.prototype.$http.get.mockResolvedValue({ data: { tid: 1, name: 'abc' } })
|
||||
|
Loading…
Reference in New Issue
Block a user