Skip to content

Commit

Permalink
add explicit test checks in reset
Browse files Browse the repository at this point in the history
  • Loading branch information
mchangrh committed Feb 22, 2023
1 parent 7ba654e commit 436e75e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/utils/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { Pool } from "pg";
import { Logger } from "../../src/utils/logger";

export async function resetRedis() {
if (config?.redis?.enabled) {
if (config?.redis?.enabled && config.mode === "test") {
const client = createClient(config.redis);
await client.connect();
await client.flushAll();
}
}
export async function resetPostgres() {
if (process.env.TEST_POSTGRES && config.postgres) {
if (process.env.TEST_POSTGRES && config.mode == "test" && config.postgres) {
const pool = new Pool({ ...config.postgres });
await pool.query(`DROP DATABASE IF EXISTS "sponsorTimes"`);
await pool.query(`DROP DATABASE IF EXISTS "privateDB"`);
Expand Down

0 comments on commit 436e75e

Please sign in to comment.