feat: Implement logic to prevent deletion of system tasks and rewards; update APIs and tests accordingly
All checks were successful
Gitea Actions Demo / build-and-push (push) Successful in 34s

This commit is contained in:
2026-02-01 16:57:12 -05:00
parent f14de28daa
commit e42c6c1ef2
16 changed files with 324 additions and 87 deletions

View File

@@ -1,11 +1,18 @@
import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import App from '../App.vue'
describe('App', () => {
it('mounts renders properly', () => {
const wrapper = mount(App)
const wrapper = mount(App, {
global: {
stubs: {
'router-view': {
template: '<div>You did it!</div>',
},
},
},
})
expect(wrapper.text()).toContain('You did it!')
})
})

View File

@@ -0,0 +1,41 @@
import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import ItemList from '../components/shared/ItemList.vue'
const systemItem = { id: 'sys1', name: 'System Task', user_id: null }
const userItem = { id: 'user1', name: 'User Task', user_id: 'abc123' }
describe('ItemList.vue', () => {
it('does not show delete button for system items', async () => {
const wrapper = mount(ItemList, {
props: {
itemKey: 'items',
itemFields: ['name'],
deletable: true,
testItems: [systemItem],
},
global: {
stubs: ['svg'],
},
})
await flushPromises()
expect(wrapper.find('.delete-btn').exists()).toBe(false)
})
it('shows delete button for user items', async () => {
const wrapper = mount(ItemList, {
props: {
itemKey: 'items',
itemFields: ['name'],
deletable: true,
testItems: [userItem],
},
global: {
stubs: ['svg'],
},
})
await flushPromises()
expect(wrapper.find('.delete-btn').exists()).toBe(true)
})
})