add ignore clauses to tests

This commit is contained in:
Michael C
2023-02-20 22:20:47 -05:00
parent c84eb839a0
commit f70a26009c
6 changed files with 12 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
export function createMemoryCache(memoryFn: (...args: any[]) => void, cacheTimeMs: number): any {
/* istanbul ignore if */
if (isNaN(cacheTimeMs)) cacheTimeMs = 0;
// holds the promise results

View File

@@ -11,7 +11,7 @@ export const isUserTempVIP = async (hashedUserID: HashedUserID, videoID: VideoID
try {
const reply = await redis.get(tempVIPKey(hashedUserID));
return reply && reply == channelID;
} catch (e) {
} catch (e) /* istanbul ignore next */ {
Logger.error(e as string);
return false;
}

View File

@@ -45,6 +45,7 @@ class Logger {
};
constructor() {
/* istanbul ignore if */
if (config.mode === "development") {
this._settings.INFO = true;
this._settings.DEBUG = true;
@@ -73,9 +74,11 @@ class Logger {
let color = colors.Bright;
if (level === LogLevel.ERROR) color = colors.FgRed;
/* istanbul ignore if */
if (level === LogLevel.WARN) color = colors.FgYellow;
let levelStr = level.toString();
/* istanbul ignore if */
if (levelStr.length === 4) {
levelStr += " "; // ensure logs are aligned
}

View File

@@ -135,17 +135,21 @@ if (config.redis?.enabled) {
.then((reply) => resolve(reply))
.catch((err) => reject(err))
);
/* istanbul ignore next */
client.on("error", function(error) {
lastClientFail = Date.now();
Logger.error(`Redis Error: ${error}`);
});
/* istanbul ignore next */
client.on("reconnect", () => {
Logger.info("Redis: trying to reconnect");
});
/* istanbul ignore next */
readClient?.on("error", function(error) {
lastReadFail = Date.now();
Logger.error(`Redis Read-Only Error: ${error}`);
});
/* istanbul ignore next */
readClient?.on("reconnect", () => {
Logger.info("Redis Read-Only: trying to reconnect");
});