mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +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/cache": "1.4.0-alpha",
|
||||||
"@nocobase/database": "1.4.0-alpha",
|
"@nocobase/database": "1.4.0-alpha",
|
||||||
"@nocobase/resourcer": "1.4.0-alpha",
|
"@nocobase/resourcer": "1.4.0-alpha",
|
||||||
|
"@nocobase/test": "1.4.0-alpha",
|
||||||
"@nocobase/utils": "1.4.0-alpha",
|
"@nocobase/utils": "1.4.0-alpha",
|
||||||
"@types/jsonwebtoken": "^8.5.8",
|
"@types/jsonwebtoken": "^8.5.8",
|
||||||
"jsonwebtoken": "^8.5.1"
|
"jsonwebtoken": "^8.5.1"
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Database } from '@nocobase/database';
|
import { Database } from '@nocobase/database';
|
||||||
import { MockServer, mockServer } from '@nocobase/test';
|
import { MockServer, createMockServer } from '@nocobase/test';
|
||||||
import { vi } from 'vitest';
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
describe('middleware', () => {
|
describe('middleware', () => {
|
||||||
@ -17,14 +17,13 @@ describe('middleware', () => {
|
|||||||
let agent;
|
let agent;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
app = mockServer({
|
app = await createMockServer({
|
||||||
registerActions: true,
|
registerActions: true,
|
||||||
acl: true,
|
acl: true,
|
||||||
plugins: ['users', 'auth', 'acl', 'data-source-manager'],
|
plugins: ['users', 'auth', 'acl', 'data-source-manager'],
|
||||||
});
|
});
|
||||||
|
|
||||||
// app.plugin(ApiKeysPlugin);
|
// app.plugin(ApiKeysPlugin);
|
||||||
await app.loadAndInstall({ clean: true });
|
|
||||||
db = app.db;
|
db = app.db;
|
||||||
agent = app.agent();
|
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();
|
const client = await this.getAdapter();
|
||||||
return client.acquire(key, ttl);
|
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 { version, beforeInstall, skipInstall, skipStart, ...others } = options;
|
||||||
const app: MockServer = mockServer(others);
|
const app: MockServer = mockServer(others);
|
||||||
if (!skipInstall) {
|
if (!skipInstall) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user