Skip to content

Instantly share code, notes, and snippets.

@jimmiehansson
Created December 3, 2018 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmiehansson/0b01d2477f62b5a7068b160507ead4d0 to your computer and use it in GitHub Desktop.
Save jimmiehansson/0b01d2477f62b5a7068b160507ead4d0 to your computer and use it in GitHub Desktop.
example
// quick example
function expectedLogSuffix (expression = { str: '', encounters: 2 }) {
var { str, encounters } = expression
if (str === null || str.length === 0 || typeof str !== 'string') {
return undefined
}
var trim = str.split(' ').filter(n => n.match(/^[A-Z]{4}s*/))
return trim.length === encounters
}
// expected format
var fmt = {
str: actual,
encounters: 2
}
// make for cleaner unit abstraction
is(expectedLogSuffix(fmt), true)
isNot(actual.match('pino.final with prettyPrint does not support flushing'), null)
isNot(actual.match('beforeExit'), null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment