-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a couple more tests and eslint fixes
- Loading branch information
Giovanni Bucci
committed
Apr 19, 2024
1 parent
677fffe
commit c0eff10
Showing
4 changed files
with
61 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict' | ||
|
||
const Busboy = require('../lib/main') | ||
const { test } = require('tap') | ||
|
||
test('busboy, emit', t => { | ||
t.plan(1) | ||
|
||
t.test('returns undefined when the event is called a second time and the busboy was already finished', t => { | ||
const busboy = new Busboy({ headers: { 'content-type': 'application/x-www-form-urlencoded' } }) | ||
busboy._finished = true | ||
busboy.emit('finish') | ||
|
||
t.equal(busboy.emit('finish'), undefined) | ||
t.end() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict' | ||
|
||
const Multipart = require('../lib/types/multipart') | ||
const Busboy = require('../lib/main') | ||
const { test } = require('tap') | ||
|
||
test('multipart constructor', t => { | ||
t.plan(1) | ||
|
||
t.test('throws if the boundary is not a string', t => { | ||
const busboy = new Busboy({ headers: { 'content-type': 'application/x-www-form-urlencoded' } }) | ||
|
||
t.throws(() => new Multipart(busboy, { boundary: 123 }), new Error('Multipart: Boundary not found')) | ||
t.end() | ||
}) | ||
}) |