All files / src/PgBoss util.ts

85.71% Statements 6/7
100% Branches 2/2
50% Functions 1/2
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14  38x               38x   38x 2x  
import { PgBossQueue } from './types';
import { availableQueues } from '@cardano-sdk/projection-typeorm';
 
/**
 * Checks if a string value is the name of a **pg-boss** queue.
 *
 * @param queue the string to check
 * @returns `true` if the value of `queue` is the name of a **pg-boss** queue
 */
export const isValidQueue = (queue: string): queue is PgBossQueue => availableQueues.includes(queue as PgBossQueue);
 
export const isErrorWithConstraint = (error: unknown): error is Error & { constraint: unknown } =>
  error instanceof Error && 'constraint' in error;