mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
chore: vitest support (#4026)
* chore: vitest * chore: move test files * chore: support vitest * fix: exclude test files * chore(ci): add test workflow * feat: remove read env
This commit is contained in:
18
test/test.ts
Normal file
18
test/test.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { MongoUser } from '@fastgpt/service/support/user/schema';
|
||||
import { it, expect } from 'vitest';
|
||||
|
||||
it('should be a test', async () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
it('should be able to connect to mongo', async () => {
|
||||
expect(global.mongodb).toBeDefined();
|
||||
expect(global.mongodb?.connection.readyState).toBe(1);
|
||||
await MongoUser.create({
|
||||
username: 'test',
|
||||
password: '123456'
|
||||
});
|
||||
const user = await MongoUser.findOne({ username: 'test' });
|
||||
expect(user).toBeDefined();
|
||||
expect(user?.username).toBe('test');
|
||||
});
|
Reference in New Issue
Block a user