initialize Electron desktop app and remove unused files
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
// @vitest-environment jsdom
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { createPinia, setActivePinia } from 'pinia'
|
||||
import ArcoVue from '@arco-design/web-vue'
|
||||
import FileList from '@/components/hermes/files/FileList.vue'
|
||||
import FileTree from '@/components/hermes/files/FileTree.vue'
|
||||
import { useFilesStore } from '@/stores/hermes/files'
|
||||
import { listFiles } from '@/api/hermes/files'
|
||||
|
||||
vi.mock('vue-i18n', () => ({
|
||||
useI18n: () => ({ t: (key: string) => key }),
|
||||
}))
|
||||
|
||||
vi.mock('@/api/hermes/files', () => ({
|
||||
listFiles: vi.fn(),
|
||||
}))
|
||||
|
||||
vi.mock('@/api/hermes/download', () => ({
|
||||
downloadFile: vi.fn(),
|
||||
}))
|
||||
|
||||
function mountFileList() {
|
||||
return mount(FileList, {
|
||||
global: {
|
||||
plugins: [ArcoVue],
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
describe('workspace long names', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
setActivePinia(createPinia())
|
||||
})
|
||||
|
||||
it('exposes full file names as hover titles in the file list', () => {
|
||||
const store = useFilesStore()
|
||||
const longName = 'very-long-generated-report-name-that-would-be-truncated-in-the-workspace-list.md'
|
||||
store.entries = [{
|
||||
name: longName,
|
||||
path: longName,
|
||||
isDir: false,
|
||||
size: 123,
|
||||
modTime: '2026-06-16T00:00:00Z',
|
||||
}]
|
||||
|
||||
const wrapper = mountFileList()
|
||||
|
||||
expect(wrapper.find('.file-label').text()).toBe(longName)
|
||||
expect(wrapper.find('.file-label').attributes('title')).toBe(longName)
|
||||
})
|
||||
|
||||
it('exposes full folder names as hover titles in the workspace tree', async () => {
|
||||
const longName = 'very-long-folder-name-that-needs-a-hover-title'
|
||||
vi.mocked(listFiles).mockResolvedValue({
|
||||
path: '',
|
||||
entries: [{
|
||||
name: longName,
|
||||
path: longName,
|
||||
isDir: true,
|
||||
size: 0,
|
||||
modTime: '2026-06-16T00:00:00Z',
|
||||
}],
|
||||
} as any)
|
||||
|
||||
const wrapper = mount(FileTree, {
|
||||
global: {
|
||||
plugins: [ArcoVue],
|
||||
},
|
||||
})
|
||||
await vi.waitFor(() => {
|
||||
expect(wrapper.find('.tree-node-label').exists()).toBe(true)
|
||||
})
|
||||
|
||||
expect(wrapper.find('.tree-node-label').text()).toBe(longName)
|
||||
expect(wrapper.find('.tree-node-label').attributes('title')).toBe(longName)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user