Skip to content

Commit

Permalink
fix: issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Eomm committed Dec 9, 2023
1 parent 7a23ec5 commit c262b36
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/issue-88.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict'

const { test } = require('tap')
const { createWarning } = require('..')

test('Must not overwrite config', t => {
t.plan(1)

function onWarning (warning) {
t.equal(warning.code, 'CODE_1')
}

const a = createWarning('FastifyWarning', 'CODE_1', 'Msg', { unlimited: false })
createWarning('FastifyWarning', 'CODE_2', 'Msg', { unlimited: true })

process.on('warning', onWarning)
a.emit('CODE_1')
a.emit('CODE_1')

setImmediate(() => {
process.removeListener('warning', onWarning)
t.end()
})
})

0 comments on commit c262b36

Please sign in to comment.