Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nbonamy committed Dec 23, 2024
1 parent 52a1dba commit 7d72b08
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 0 additions & 2 deletions tests/screens/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/commander.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ vi.mock('electron', async() => {
const Notification = vi.fn();
Notification.prototype.show = vi.fn();
return {
app: {},
app: {
getPath: vi.fn(() => '')
},
Notification
}
})
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/docrepo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/window.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ vi.mock('electron', async () => {
openDevTools: vi.fn(),
}
const app = {
getPath: vi.fn(() => ''),
dock: {
show: vi.fn(),
hide: vi.fn(),
Expand Down Expand Up @@ -76,6 +77,7 @@ vi.mock('electron', async () => {

vi.mock('../../src/main/utils', async () => {
return {
wait: vi.fn(),
putCachedText: vi.fn(() => 'textId')
}
})
Expand Down

0 comments on commit 7d72b08

Please sign in to comment.