Skip to content

Commit

Permalink
fix ci on the utils.isProcessFormData
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNorthMemory committed May 15, 2021
1 parent 4267fa3 commit d4da45f
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions tests/lib/utils.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const should = require('should');

const utils = require('../../lib/utils');
const Multipart = require('../../lib/multipart');

describe('lib/utils', () => {
it('should be an Object', () => {
Expand All @@ -27,6 +28,11 @@ describe('lib/utils', () => {
should(utils.isObject).be.a.Function();
});

it('should have `isStream` property and be a function', () => {
utils.should.have.property('isStream');
should(utils.isStream).be.a.Function();
});

it('should have `merge` property and be a function', () => {
utils.should.have.property('merge');
should(utils.merge).be.a.Function();
Expand Down Expand Up @@ -60,12 +66,32 @@ describe('lib/utils', () => {
utils.isProcessFormData().should.be.a.Boolean();
});

const mockup = {
toString: () => '[object FormData]',
};
it('method `isProcessFormData` should returns boolean `true` under Node environment', () => {
mockup.should.be.an.Object();
utils.isProcessFormData(mockup).should.be.a.Boolean().and.be.True();
(new Multipart()).should.be.an.Object();
utils.isProcessFormData(new Multipart()).should.be.a.Boolean().and.be.True();
});

it('method `isProcessFormData` should returns boolean `true` under Node environment', () => {
(new Multipart.FormData()).should.be.an.Object();
utils.isProcessFormData(new Multipart.FormData()).should.be.a.Boolean().and.be.True();
});
});

describe('utils::isStream', () => {
it('method `isStream` should be function', () => {
should(utils.isStream).be.a.Function();
});

it('method `isStream` should returns Boolean', () => {
utils.isStream().should.be.a.Boolean();
});

it('method `isStream` should returns boolean `true` while the `Multipart` instance passed in', () => {
utils.isStream(new Multipart()).should.be.a.Boolean().and.be.True();
});

it('method `isStream` should returns boolean `true` while the `FormData` instance passed in', () => {
utils.isStream(new Multipart.FormData()).should.be.a.Boolean().and.be.True();
});
});
});

0 comments on commit d4da45f

Please sign in to comment.