test(server): avoid progress get hold after tests finished (#5522)

This commit is contained in:
liuyi
2024-01-11 06:40:53 +00:00
parent 5aee480c50
commit 9253e522aa
36 changed files with 262 additions and 194 deletions
@@ -167,8 +167,13 @@ export class AuthResolver {
@CurrentUser() user: UserType,
@Args('token') token: string
) {
const key = await this.session.get(token);
if (!key) {
throw new ForbiddenException('Invalid token');
}
// email has set token in `sendVerifyChangeEmail`
const [id, email] = (await this.session.get(token)).split(',');
const [id, email] = key.split(',');
if (!id || id !== user.id || !email) {
throw new ForbiddenException('Invalid token');
}
@@ -6,18 +6,8 @@ import { ServerOptions } from 'socket.io';
export class RedisIoAdapter extends IoAdapter {
private adapterConstructor: ReturnType<typeof createAdapter> | undefined;
async connectToRedis(
host: string,
port: number,
username: string,
password: string,
db: number
): Promise<void> {
const pubClient = new Redis(port, host, {
username,
password,
db,
});
async connectToRedis(redis: Redis): Promise<void> {
const pubClient = redis;
pubClient.on('error', err => {
console.error(err);
});