Files
FastGPT/test/test.ts
Finley Ge bb30ca4859 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
2025-03-12 19:27:53 +08:00

19 lines
532 B
TypeScript

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');
});