-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: replace mocha and chai with tap (#123)
* initial * transform more * move conversion * more * minor * minor * Update test/types-multipart.test.js Co-authored-by: Gürgün Dayıoğlu <gurgun.dayioglu@icloud.com> --------- Co-authored-by: Gürgün Dayıoğlu <gurgun.dayioglu@icloud.com>
- Loading branch information
Showing
27 changed files
with
1,394 additions
and
1,444 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
files: | ||
- test/**/*.test.js | ||
|
||
coverage: false |
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 was deleted.
Oops, something went wrong.
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,75 @@ | ||
'use strict' | ||
|
||
const Busboy = require('../lib/main') | ||
const { test } = require('tap') | ||
|
||
test('busboy-constructor - should throw an Error if no options are provided', t => { | ||
t.plan(1) | ||
|
||
t.throws(() => new Busboy(), new Error('Busboy expected an options-Object.')) | ||
}) | ||
|
||
test('busboy-constructor - should throw an Error if options does not contain headers', t => { | ||
t.plan(1) | ||
|
||
t.throws(() => new Busboy({}), new Error('Busboy expected an options-Object with headers-attribute.')) | ||
}) | ||
|
||
test('busboy-constructor - if busboy is called without new-operator, still creates a busboy instance', t => { | ||
t.plan(1) | ||
|
||
const busboyInstance = Busboy({ headers: { 'content-type': 'application/x-www-form-urlencoded' } }) | ||
t.type(busboyInstance, Busboy) | ||
}) | ||
|
||
test('busboy-constructor - should throw an Error if content-type is not set', t => { | ||
t.plan(1) | ||
|
||
t.throws(() => new Busboy({ headers: {} }), new Error('Missing Content-Type-header.')) | ||
}) | ||
|
||
test('busboy-constructor - should throw an Error if content-type is unsupported', t => { | ||
t.plan(1) | ||
|
||
t.throws(() => new Busboy({ headers: { 'content-type': 'unsupported' } }), new Error('Unsupported Content-Type.')) | ||
}) | ||
|
||
test('busboy-constructor - should not throw an Error if content-type is urlencoded', t => { | ||
t.plan(1) | ||
|
||
t.doesNotThrow(() => new Busboy({ headers: { 'content-type': 'application/x-www-form-urlencoded' } })) | ||
}) | ||
|
||
test('busboy-constructor - if busboy is called without stream options autoDestroy is set to false', t => { | ||
t.plan(1) | ||
|
||
const busboyInstance = Busboy({ headers: { 'content-type': 'application/x-www-form-urlencoded' } }) | ||
t.equal(busboyInstance._writableState.autoDestroy, false) | ||
}) | ||
|
||
test('busboy-constructor - if busboy is called with invalid value for stream option highWaterMark we should throw', t => { | ||
t.plan(1) | ||
|
||
t.throws(() => Busboy({ highWaterMark: 'not_allowed_value_for_highWaterMark', headers: { 'content-type': 'application/x-www-form-urlencoded' } }), new Error('not_allowed_value_for_highWaterMark')) | ||
}) | ||
|
||
test('busboy-constructor - if busboy is called with stream options and autoDestroy:true, autoDestroy should be set to true', t => { | ||
t.plan(1) | ||
|
||
const busboyInstance = Busboy({ autoDestroy: true, headers: { 'content-type': 'application/x-www-form-urlencoded' } }) | ||
t.equal(busboyInstance._writableState.autoDestroy, true) | ||
}) | ||
|
||
test('busboy-constructor - busboy should be initialized with private attribute _done set as false', t => { | ||
t.plan(1) | ||
|
||
const busboyInstance = Busboy({ headers: { 'content-type': 'application/x-www-form-urlencoded' } }) | ||
t.equal(busboyInstance._done, false) | ||
}) | ||
|
||
test('busboy-constructor - busboy should be initialized with private attribute _finished set as false', t => { | ||
t.plan(1) | ||
|
||
const busboyInstance = Busboy({ headers: { 'content-type': 'application/x-www-form-urlencoded' } }) | ||
t.equal(busboyInstance._finished, false) | ||
}) |
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 was deleted.
Oops, something went wrong.
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,22 @@ | ||
'use strict' | ||
|
||
const { test } = require('tap') | ||
const Dicer = require('../deps/dicer/lib/Dicer') | ||
|
||
test('dicer-constructor', t => { | ||
t.plan(2) | ||
|
||
t.test('should throw an Error when no options parameter is supplied to Dicer', t => { | ||
t.plan(1) | ||
|
||
t.throws(() => new Dicer(), new Error('Boundary required')) | ||
}) | ||
|
||
t.test('without new operator a new dicer instance will be initialized', t => { | ||
t.plan(1) | ||
|
||
t.type(Dicer({ | ||
boundary: '----boundary' | ||
}), Dicer) | ||
}) | ||
}) |
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 was deleted.
Oops, something went wrong.
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,24 @@ | ||
'use strict' | ||
|
||
const { test } = require('tap') | ||
const { Dicer } = require('../lib/main') | ||
|
||
test('dicer-export', t => { | ||
t.plan(2) | ||
|
||
t.test('without new operator a new dicer instance will be initialized', t => { | ||
t.plan(1) | ||
|
||
t.type(Dicer({ | ||
boundary: '----boundary' | ||
}), Dicer) | ||
}) | ||
|
||
t.test('with new operator a new dicer instance will be initialized', t => { | ||
t.plan(1) | ||
|
||
t.type(new Dicer({ | ||
boundary: '----boundary' | ||
}), Dicer) | ||
}) | ||
}) |
Oops, something went wrong.