All files / proxy/utils/customer-variables maybe-obfuscate-variable.ts

100% Statements 5/5
100% Branches 4/4
100% Functions 1/1
100% Lines 5/5

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 15 16        7x     39x   39x 4x     39x    
import type { CustomerVariables } from './customer-variables.ts'
import { CustomerVariableName } from './types.ts'
import { isTruthy } from '../is-truthy.ts'
 
export const OBFUSCATED_VALUE = '********'
 
export async function maybeObfuscateVariable(customerVariables: CustomerVariables, variable: CustomerVariableName) {
  const result = await customerVariables.getVariable(variable)
 
  if (variable === CustomerVariableName.PreSharedSecret && isTruthy(result.value)) {
    result.value = OBFUSCATED_VALUE
  }
 
  return result
}