Skip to content

Commit

Permalink
test(memory): add simple test for user service
Browse files Browse the repository at this point in the history
  • Loading branch information
dingyi222666 committed Mar 16, 2024
1 parent bf32726 commit 93b470a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
3 changes: 1 addition & 2 deletions packages/memory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
"@chatluna/core": "0.0.2"
},
"devDependencies": {
"@minatojs/driver-memory": "^3.0.0",
"@minatojs/driver-sqlite": "^4.0.0"
"@minatojs/driver-memory": "^3.0.0"
}
}
11 changes: 2 additions & 9 deletions packages/memory/tests/user_service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { apply } from '@chatluna/memory'
import SQLiteDriver from '@minatojs/driver-sqlite'
import MemoryDriver from '@minatojs/driver-memory'
import * as chai from 'chai'
import { should } from 'chai'
import chaiAsPromised from 'chai-as-promised'
import { Context } from 'cordis'
import { Database } from 'minato'
import { after, before } from 'mocha'
import * as fs from 'node:fs/promises'
import { waitServiceLoad } from './mock/utils.ts'

const app = new Context()
Expand All @@ -32,8 +31,6 @@ describe('User service', () => {
lastChatTime: date
})

cons

user.should.be.eql({
userId: 'a',
excludeModels: ['gpt'],
Expand All @@ -55,10 +52,7 @@ app.on('ready', async () => {
const database = new Database()
app.provide('database', database)

await app.database.connect(SQLiteDriver, {
path: './test/sql.db'
})
//await app.database.connect(MemoryDriver, {})
await app.database.connect(MemoryDriver, {})
app.plugin(apply)
})

Expand All @@ -68,5 +62,4 @@ before(async () => {

after(async () => {
await app.stop()
await fs.rm('./test/sql.db', { force: true })
})

0 comments on commit 93b470a

Please sign in to comment.