Skip to content

Commit 7b3c05a

Browse files
committed
improve tests for multipart with empty component
1 parent ba5bd72 commit 7b3c05a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/Multipart.test.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ describe("Multipart", function () {
135135
const parsedMultipart = Multipart.parse(multipartBytes);
136136
expect(parsedMultipart).to.be.an.instanceof(Multipart);
137137
expect(parsedMultipart.parts.length).to.equal(1);
138-
expect(new TextDecoder().decode(parsedMultipart.parts[0].bytes())).to.equal("\r\n");
138+
const part = parsedMultipart.parts[0];
139+
expect(part.bytes()).to.deep.equal(Multipart.CRLF);
140+
expect(part.headers).to.be.empty;
141+
expect(part.body).to.be.empty;
139142
});
140143

141144
it("should handle parsing of empty parts in multipart MIME string", function () {
@@ -149,7 +152,10 @@ describe("Multipart", function () {
149152
const parsedMultipart = Multipart.parse(multipartBytes);
150153
expect(parsedMultipart).to.be.an.instanceof(Multipart);
151154
expect(parsedMultipart.parts.length).to.equal(1);
152-
expect(new TextDecoder().decode(parsedMultipart.parts[0].bytes())).to.equal("\r\n");
155+
const part = parsedMultipart.parts[0];
156+
expect(part.bytes()).to.deep.equal(Multipart.CRLF);
157+
expect(part.headers).to.be.empty;
158+
expect(part.body).to.be.empty;
153159
});
154160

155161
it("should ignore linear whitespace after boundary delimiter", function () {

0 commit comments

Comments
 (0)