mirror of
https://github.com/kevinthedang/discord-ollama.git
synced 2025-12-12 11:56:06 -05:00
* add redis container * Updated Guides and Goals (#134) * Update README.md * Update commands-guide.md * Update events-guide.md * Update commands-guide.md * Added: redis client * Fixed: redis mock in commands.test.ts * Updated: npm package patches * Fixed: redis ip name in keys.ts * update Node LTS version, workflow env vars * Updated: node package engine requirements * Updated: documentation * fix: upgrade dotenv from 16.4.5 to 16.4.7 (#152) Snyk has created this PR to upgrade dotenv from 16.4.5 to 16.4.7. See this package in npm: dotenv See this project in Snyk: https://app.snyk.io/org/jt2m0l3y/project/d8b070a3-e4a3-457a-977b-7eb6a4a48346?utm_source=github&utm_medium=referral&page=upgrade-pr Co-authored-by: snyk-bot <snyk-bot@snyk.io> * Update: docs patches, connection ordering --------- Co-authored-by: snyk-bot <snyk-bot@snyk.io>
84 lines
2.1 KiB
TypeScript
84 lines
2.1 KiB
TypeScript
// describe marks a test suite
|
|
// expect takes a value from an expression
|
|
// it marks a test case
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
import commands from '../src/commands/index.js'
|
|
|
|
/**
|
|
* Mocking redis found in client.ts because of the commands
|
|
*/
|
|
vi.mock('../src/client.js', () => ({
|
|
redis: {
|
|
createClient: vi.fn(),
|
|
connect: vi.fn(),
|
|
get: vi.fn(),
|
|
set: vi.fn()
|
|
}
|
|
}))
|
|
|
|
/**
|
|
* Commands test suite, tests the commands object
|
|
* Each command is to be tested elsewhere, this file
|
|
* is to ensure that the commands object is defined.
|
|
*
|
|
* @param name name of the test suite
|
|
* @param fn function holding tests to run
|
|
*/
|
|
describe('Commands Existence', () => {
|
|
// test definition of commands object
|
|
it('references defined object', () => {
|
|
// toBe compares the value to the expected value
|
|
expect(typeof commands).toBe('object')
|
|
})
|
|
|
|
// 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-stream, toggle-chat, shutoff, modify-capacity, clear-user-channel-history, pull-model, switch-model, delete-model')
|
|
})
|
|
})
|
|
|
|
/**
|
|
* User Commands Test suite for testing out commands
|
|
* that would be run by users when using the application.
|
|
*/
|
|
describe('User Command Tests', () => {
|
|
// test capacity command
|
|
it('run modify-capacity command', () => {
|
|
|
|
})
|
|
|
|
it('run clear-user-channel-history command', () => {
|
|
|
|
})
|
|
|
|
it('run message-stream command', () => {
|
|
|
|
})
|
|
|
|
it('run message-style command', () => {
|
|
|
|
})
|
|
|
|
it('run thread command', () => {
|
|
|
|
})
|
|
|
|
it('run private-thread command', () => {
|
|
|
|
})
|
|
})
|
|
|
|
/**
|
|
* Admin Commands Test suite for running administrative
|
|
* commands with the application.
|
|
*/
|
|
describe('Admin Command Tests', () => {
|
|
it('run shutoff command', () => {
|
|
|
|
})
|
|
|
|
it('run toggle-chat command', () => {
|
|
|
|
})
|
|
}) |