Pull Model Command (#125)

* Add: Pull Model Command

* Fix: Missing ollama mock for PullModel
This commit is contained in:
Kevin Dang
2024-10-12 17:53:34 -07:00
committed by GitHub
parent 5061dab335
commit 5d02800c3f
5 changed files with 63 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ describe('Commands Existence', () => {
// test specific commands in the object
it('references specific commands', () => {
const commandsString = commands.map(e => e.name).join(', ')
expect(commandsString).toBe('thread, private-thread, message-style, message-stream, toggle-chat, shutoff, modify-capacity, clear-user-channel-history')
expect(commandsString).toBe('thread, private-thread, message-style, message-stream, toggle-chat, shutoff, modify-capacity, clear-user-channel-history, pull-model')
})
})

View File

@@ -1,13 +1,21 @@
import { describe, expect, it } from 'vitest'
import { describe, expect, it, vi } from 'vitest'
import events from '../src/events/index.js'
/**
* Mocking ollama found in client.ts because pullModel.ts
* relies on the existence on ollama. To prevent the mock,
* we will have to pass through ollama to the commands somehow.
*/
vi.mock('../src/client.js', () => ({
ollama: {
pull: vi.fn() // Mock the pull method found with ollama
}
}))
/**
* Events test suite, tests the events object
* Each event is to be tested elsewhere, this file
* is to ensure that the events object is defined.
*
* @param name name of the test suite
* @param fn function holding tests to run
*/
describe('Events Existence', () => {
// test definition of events object