4.8.11 test (#2843)
* feat: app version test * update doc * fix: paging num error * fix: doc api domain * rename variable * perf: memment node min size
This commit is contained in:
@@ -57,11 +57,25 @@ jest.mock('@/service/middleware/entry', () => {
|
||||
});
|
||||
|
||||
beforeAll(async () => {
|
||||
// 新建一个内存数据库,然后让 mongoose 连接这个数据库
|
||||
if (!global.mongod || !global.mongodb) {
|
||||
const mongod = await MongoMemoryServer.create();
|
||||
global.mongod = mongod;
|
||||
global.mongodb = mongoose;
|
||||
await global.mongodb.connect(mongod.getUri());
|
||||
|
||||
await global.mongodb.connect(mongod.getUri(), {
|
||||
bufferCommands: true,
|
||||
maxConnecting: 50,
|
||||
maxPoolSize: 50,
|
||||
minPoolSize: 20,
|
||||
connectTimeoutMS: 60000,
|
||||
waitQueueTimeoutMS: 60000,
|
||||
socketTimeoutMS: 60000,
|
||||
maxIdleTimeMS: 300000,
|
||||
retryWrites: true,
|
||||
retryReads: true
|
||||
});
|
||||
|
||||
await initMockData();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -13,34 +13,37 @@ export const root = {
|
||||
};
|
||||
|
||||
export const initMockData = async () => {
|
||||
// init root user
|
||||
const rootUser = await MongoUser.create({
|
||||
username: 'root',
|
||||
password: '123456'
|
||||
});
|
||||
const initRootUser = async () => {
|
||||
// init root user
|
||||
const rootUser = await MongoUser.create({
|
||||
username: 'root',
|
||||
password: '123456'
|
||||
});
|
||||
|
||||
const rootTeam = await MongoTeam.create({
|
||||
name: 'root-default-team',
|
||||
ownerId: rootUser._id
|
||||
});
|
||||
const rootTeam = await MongoTeam.create({
|
||||
name: 'root-default-team',
|
||||
ownerId: rootUser._id
|
||||
});
|
||||
|
||||
const rootTeamMember = await MongoTeamMember.create({
|
||||
teamId: rootTeam._id,
|
||||
userId: rootUser._id,
|
||||
name: 'root-default-team-member',
|
||||
status: 'active',
|
||||
role: TeamMemberRoleEnum.owner
|
||||
});
|
||||
const rootTeamMember = await MongoTeamMember.create({
|
||||
teamId: rootTeam._id,
|
||||
userId: rootUser._id,
|
||||
name: 'root-default-team-member',
|
||||
status: 'active',
|
||||
role: TeamMemberRoleEnum.owner
|
||||
});
|
||||
const rootApp = await MongoApp.create({
|
||||
name: 'root-default-app',
|
||||
teamId: rootTeam._id,
|
||||
tmbId: rootTeam._id,
|
||||
type: 'advanced'
|
||||
});
|
||||
|
||||
const rootApp = await MongoApp.create({
|
||||
name: 'root-default-app',
|
||||
teamId: rootTeam._id,
|
||||
tmbId: rootTeam._id,
|
||||
type: 'advanced'
|
||||
});
|
||||
root.uid = rootUser._id;
|
||||
root.tmbId = rootTeamMember._id;
|
||||
root.teamId = rootTeam._id;
|
||||
root.appId = rootApp._id;
|
||||
};
|
||||
|
||||
root.uid = rootUser._id;
|
||||
root.tmbId = rootTeamMember._id;
|
||||
root.teamId = rootTeam._id;
|
||||
root.appId = rootApp._id;
|
||||
await initRootUser();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user