Initial commit: Telegram Management System
Some checks failed
Deploy / deploy (push) Has been cancelled
Some checks failed
Deploy / deploy (push) Has been cancelled
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>
This commit is contained in:
49
marketing-agent/tests/helpers/redis.js
Normal file
49
marketing-agent/tests/helpers/redis.js
Normal file
@@ -0,0 +1,49 @@
|
||||
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(),
|
||||
};
|
||||
Reference in New Issue
Block a user