diff --git a/tests/screens/main.test.ts b/tests/screens/main.test.ts index 3082cdf..b43cb35 100644 --- a/tests/screens/main.test.ts +++ b/tests/screens/main.test.ts @@ -138,9 +138,7 @@ test('Stop assistant', async () => { }) test('New chat in folder', async () => { - console.log(store.history.chats) mount(Main) - console.log(store.history.chats) emitEvent('new-chat-in-folder', 'folder') expect(store.history.chats).toHaveLength(2) expect(store.history.folders[0].chats).toHaveLength(1) diff --git a/tests/unit/commander.test.ts b/tests/unit/commander.test.ts index 94742f1..78641ff 100644 --- a/tests/unit/commander.test.ts +++ b/tests/unit/commander.test.ts @@ -18,7 +18,9 @@ vi.mock('electron', async() => { const Notification = vi.fn(); Notification.prototype.show = vi.fn(); return { - app: {}, + app: { + getPath: vi.fn(() => '') + }, Notification } }) diff --git a/tests/unit/docrepo.test.ts b/tests/unit/docrepo.test.ts index a0eba76..c3629f0 100644 --- a/tests/unit/docrepo.test.ts +++ b/tests/unit/docrepo.test.ts @@ -137,10 +137,10 @@ test('Docrepo add document', async () => { test('Doc base invalid documents', async () => { const docbase = new DocumentBaseImpl(app, null, '1', 'name', 'openai', 'text-embedding-ada-002') await docbase.create() - expect(() => docbase.addDocument(new DocumentSourceImpl('1', 'file', 'test.jpg'))).rejects.toThrowError(/^Unsupported document type$/) - expect(() => docbase.addDocument(new DocumentSourceImpl('1', 'file', 'test.png'))).rejects.toThrowError(/^Unsupported document type$/) - expect(() => docbase.addDocument(new DocumentSourceImpl('1', 'file', 'test.docx'))).rejects.toThrowError(/^Unable to load document$/) - expect(() => docbase.addDocument(new DocumentSourceImpl('1', 'text', EMPTY_PDF))).rejects.toThrowError(/^Empty PDF$/) + await expect(() => docbase.addDocument(new DocumentSourceImpl('1', 'file', 'test.jpg'))).rejects.toThrowError(/^Unsupported document type$/) + await expect(() => docbase.addDocument(new DocumentSourceImpl('1', 'file', 'test.png'))).rejects.toThrowError(/^Unsupported document type$/) + await expect(() => docbase.addDocument(new DocumentSourceImpl('1', 'file', 'test.docx'))).rejects.toThrowError(/^Unable to load document$/) + await expect(() => docbase.addDocument(new DocumentSourceImpl('1', 'text', EMPTY_PDF))).rejects.toThrowError(/^Empty PDF$/) }) test('Docrepo invalid documents', async () => { diff --git a/tests/unit/window.test.ts b/tests/unit/window.test.ts index 63687c2..38305d8 100644 --- a/tests/unit/window.test.ts +++ b/tests/unit/window.test.ts @@ -46,6 +46,7 @@ vi.mock('electron', async () => { openDevTools: vi.fn(), } const app = { + getPath: vi.fn(() => ''), dock: { show: vi.fn(), hide: vi.fn(), @@ -76,6 +77,7 @@ vi.mock('electron', async () => { vi.mock('../../src/main/utils', async () => { return { + wait: vi.fn(), putCachedText: vi.fn(() => 'textId') } })