mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +08:00
fix(auth): fix test case
This commit is contained in:
parent
c49c1704fd
commit
c1db4f2e0c
@ -10,6 +10,7 @@
|
||||
"@nocobase/cache": "1.4.0-alpha",
|
||||
"@nocobase/database": "1.4.0-alpha",
|
||||
"@nocobase/resourcer": "1.4.0-alpha",
|
||||
"@nocobase/test": "1.4.0-alpha",
|
||||
"@nocobase/utils": "1.4.0-alpha",
|
||||
"@types/jsonwebtoken": "^8.5.8",
|
||||
"jsonwebtoken": "^8.5.1"
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
import { Database } from '@nocobase/database';
|
||||
import { MockServer, mockServer } from '@nocobase/test';
|
||||
import { MockServer, createMockServer } from '@nocobase/test';
|
||||
import { vi } from 'vitest';
|
||||
|
||||
describe('middleware', () => {
|
||||
@ -17,14 +17,13 @@ describe('middleware', () => {
|
||||
let agent;
|
||||
|
||||
beforeEach(async () => {
|
||||
app = mockServer({
|
||||
app = await createMockServer({
|
||||
registerActions: true,
|
||||
acl: true,
|
||||
plugins: ['users', 'auth', 'acl', 'data-source-manager'],
|
||||
});
|
||||
|
||||
// app.plugin(ApiKeysPlugin);
|
||||
await app.loadAndInstall({ clean: true });
|
||||
db = app.db;
|
||||
agent = app.agent();
|
||||
});
|
||||
|
@ -150,7 +150,7 @@ export class LockManager {
|
||||
}
|
||||
}
|
||||
|
||||
public async acquire(key: string, ttl = 500) {
|
||||
public async acquire(key: string, ttl = 500): Promise<Releaser> {
|
||||
const client = await this.getAdapter();
|
||||
return client.acquire(key, ttl);
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ export async function createMockCluster({
|
||||
};
|
||||
}
|
||||
|
||||
export async function createMockServer(options: MockServerOptions = {}) {
|
||||
export async function createMockServer(options: MockServerOptions = {}): Promise<MockServer> {
|
||||
const { version, beforeInstall, skipInstall, skipStart, ...others } = options;
|
||||
const app: MockServer = mockServer(others);
|
||||
if (!skipInstall) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user