Skip to content

Commit

Permalink
test: 100% branch coverage in main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Gesma94 committed Apr 29, 2024
1 parent 17c37ca commit 2721d50
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion test/types-urlencoded.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ tests.forEach((v) => {
})
})

test('Call end twice', t => {
test('Call parser end twice', t => {
t.plan(1)

let finishes = 0
Expand All @@ -258,3 +258,28 @@ test('Call end twice', t => {
busboy._parser.end()
busboy._parser.end()
})

test('Call emit finish twice', t => {
t.plan(2)

let fields = 0
let finishes = 0

Check failure on line 267 in test/types-urlencoded.test.js

View workflow job for this annotation

GitHub Actions / Linting and Types (16.x)

Trailing spaces not allowed
const busboy = new Busboy({
headers: {
'content-type': 'application/x-www-form-urlencoded; charset=utf-8'
}
})
busboy.on('field', function () {
t.ok(++fields === 1, 'field emitted')
})

busboy.on('finish', function () {
t.ok(++finishes === 1, 'finish emitted')
})

busboy.write(Buffer.from('Hello world', 'utf8'), EMPTY_FN)

busboy.emit('finish');

Check failure on line 283 in test/types-urlencoded.test.js

View workflow job for this annotation

GitHub Actions / Linting and Types (16.x)

Extra semicolon
busboy.emit('finish');

Check failure on line 284 in test/types-urlencoded.test.js

View workflow job for this annotation

GitHub Actions / Linting and Types (16.x)

Extra semicolon
})

Check failure on line 285 in test/types-urlencoded.test.js

View workflow job for this annotation

GitHub Actions / Linting and Types (16.x)

Newline required at end of file but not found

0 comments on commit 2721d50

Please sign in to comment.