1
1
import { readFile } from "node:fs/promises"
2
- import { Readable } from "node:stream"
3
2
import { EOL } from "node:os"
3
+ import { Readable } from "node:stream"
4
4
5
5
import test from "ava"
6
6
7
7
// eslint-disable-next-line import/no-unresolved
8
8
import { fileFromPath } from "formdata-node/file-from-path"
9
9
10
- import { FormData , Blob , File } from "formdata-node"
10
+ import { Blob , File , FormData } from "formdata-node"
11
11
12
- import skipSync from "./__helper__/skipIterationsSync .js"
12
+ import readLine from "./__helper__/readLine .js"
13
13
import readStream from "./__helper__/readStream.js"
14
14
import skip from "./__helper__/skipIterations.js"
15
- import readLine from "./__helper__/readLine .js"
15
+ import skipSync from "./__helper__/skipIterationsSync .js"
16
16
17
17
import { FormDataEncoder } from "./FormDataEncoder.js"
18
18
@@ -23,6 +23,12 @@ test("Has boundary string", t => {
23
23
t . is ( typeof encoder . boundary , "string" )
24
24
} )
25
25
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
+
26
32
test ( "boundary property is read-only" , t => {
27
33
const encoder = new FormDataEncoder ( new FormData ( ) )
28
34
@@ -59,7 +65,7 @@ test("Accepts custom boundary as the second argument", t => {
59
65
60
66
const encoder = new FormDataEncoder ( new FormData ( ) , expected )
61
67
62
- t . is ( encoder . boundary , `form-data-boundary- ${ expected } ` )
68
+ t . is ( encoder . boundary , expected )
63
69
} )
64
70
65
71
test ( "Has content-type string" , t => {
@@ -106,10 +112,7 @@ test("Has content-type string with custom boundary string", t => {
106
112
107
113
const encoder = new FormDataEncoder ( new FormData ( ) , expected )
108
114
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 } ` )
113
116
} )
114
117
115
118
test ( "Has contentLength property" , async t => {
0 commit comments