Files
你的用户名 237c7802e5
Some checks failed
Deploy / deploy (push) Has been cancelled
Initial commit: Telegram Management System
Full-stack web application for Telegram management
- Frontend: Vue 3 + Vben Admin
- Backend: NestJS
- Features: User management, group broadcast, statistics

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 15:37:50 +08:00

49 lines
947 B
JavaScript

import redis from 'redis-mock';
let redisClient;
export const connectRedis = async () => {
redisClient = redis.createClient();
return redisClient;
};
export const closeRedis = async () => {
if (redisClient) {
await redisClient.quit();
}
};
export const clearRedis = async () => {
if (redisClient) {
await redisClient.flushall();
}
};
export const getRedisClient = () => redisClient;
// Mock Redis methods for testing
export const mockRedisClient = {
get: jest.fn(),
set: jest.fn(),
del: jest.fn(),
exists: jest.fn(),
expire: jest.fn(),
ttl: jest.fn(),
hget: jest.fn(),
hset: jest.fn(),
hdel: jest.fn(),
hgetall: jest.fn(),
sadd: jest.fn(),
srem: jest.fn(),
smembers: jest.fn(),
sismember: jest.fn(),
zadd: jest.fn(),
zrem: jest.fn(),
zrange: jest.fn(),
zrevrange: jest.fn(),
publish: jest.fn(),
subscribe: jest.fn(),
unsubscribe: jest.fn(),
on: jest.fn(),
quit: jest.fn(),
};