11import { readFile } from "node:fs/promises"
2- import { Readable } from "node:stream"
32import { EOL } from "node:os"
3+ import { Readable } from "node:stream"
44
55import test from "ava"
66
77// eslint-disable-next-line import/no-unresolved
88import { fileFromPath } from "formdata-node/file-from-path"
99
10- import { FormData , Blob , File } from "formdata-node"
10+ import { Blob , File , FormData } from "formdata-node"
1111
12- import skipSync from "./__helper__/skipIterationsSync .js"
12+ import readLine from "./__helper__/readLine .js"
1313import readStream from "./__helper__/readStream.js"
1414import skip from "./__helper__/skipIterations.js"
15- import readLine from "./__helper__/readLine .js"
15+ import skipSync from "./__helper__/skipIterationsSync .js"
1616
1717import { FormDataEncoder } from "./FormDataEncoder.js"
1818
@@ -23,6 +23,12 @@ test("Has boundary string", t => {
2323 t . is ( typeof encoder . boundary , "string" )
2424} )
2525
26+ test ( "Default boundary starts with a prefix" , t => {
27+ const encoder = new FormDataEncoder ( new FormData ( ) )
28+
29+ t . true ( encoder . boundary . startsWith ( "form-data-encoder-" ) )
30+ } )
31+
2632test ( "boundary property is read-only" , t => {
2733 const encoder = new FormDataEncoder ( new FormData ( ) )
2834
@@ -59,7 +65,7 @@ test("Accepts custom boundary as the second argument", t => {
5965
6066 const encoder = new FormDataEncoder ( new FormData ( ) , expected )
6167
62- t . is ( encoder . boundary , `form-data-boundary- ${ expected } ` )
68+ t . is ( encoder . boundary , expected )
6369} )
6470
6571test ( "Has content-type string" , t => {
@@ -106,10 +112,7 @@ test("Has content-type string with custom boundary string", t => {
106112
107113 const encoder = new FormDataEncoder ( new FormData ( ) , expected )
108114
109- t . is (
110- encoder . contentType ,
111- `multipart/form-data; boundary=form-data-boundary-${ expected } `
112- )
115+ t . is ( encoder . contentType , `multipart/form-data; boundary=${ expected } ` )
113116} )
114117
115118test ( "Has contentLength property" , async t => {
0 commit comments