@@ -6,34 +6,34 @@ import { describe, expect, it } from 'vitest';
66import { getBodyString , getFetchRequestArgBody , serializeFormData } from '../src/networkUtils' ;
77
88describe ( 'getBodyString' , ( ) => {
9- it ( 'should work with a string' , ( ) => {
9+ it ( 'works with a string' , ( ) => {
1010 const actual = getBodyString ( 'abc' ) ;
1111 expect ( actual ) . toEqual ( [ 'abc' ] ) ;
1212 } ) ;
1313
14- it ( 'should work with URLSearchParams' , ( ) => {
14+ it ( 'works with URLSearchParams' , ( ) => {
1515 const body = new URLSearchParams ( ) ;
1616 body . append ( 'name' , 'Anne' ) ;
1717 body . append ( 'age' , '32' ) ;
1818 const actual = getBodyString ( body ) ;
1919 expect ( actual ) . toEqual ( [ 'name=Anne&age=32' ] ) ;
2020 } ) ;
2121
22- it ( 'should work with FormData' , ( ) => {
22+ it ( 'works with FormData' , ( ) => {
2323 const body = new FormData ( ) ;
24- body . append ( 'name' , 'Bob ' ) ;
24+ body . append ( 'name' , 'Anne ' ) ;
2525 body . append ( 'age' , '32' ) ;
2626 const actual = getBodyString ( body ) ;
27- expect ( actual ) . toEqual ( [ 'name=Bob &age=32' ] ) ;
27+ expect ( actual ) . toEqual ( [ 'name=Anne &age=32' ] ) ;
2828 } ) ;
2929
30- it ( 'should work with empty data' , ( ) => {
30+ it ( 'works with empty data' , ( ) => {
3131 const body = undefined ;
3232 const actual = getBodyString ( body ) ;
3333 expect ( actual ) . toEqual ( [ undefined ] ) ;
3434 } ) ;
3535
36- it ( 'should return unparsable with other types of data' , ( ) => {
36+ it ( 'works with other type of data' , ( ) => {
3737 const body = { } ;
3838 const actual = getBodyString ( body ) ;
3939 expect ( actual ) . toEqual ( [ undefined , 'UNPARSEABLE_BODY_TYPE' ] ) ;
@@ -42,15 +42,15 @@ describe('getBodyString', () => {
4242
4343describe ( 'getFetchRequestArgBody' , ( ) => {
4444 describe ( 'valid types of body' , ( ) => {
45- it ( 'should work with json string' , ( ) => {
45+ it ( 'works with json string' , ( ) => {
4646 const body = { data : [ 1 , 2 , 3 ] } ;
4747 const jsonBody = JSON . stringify ( body ) ;
4848
4949 const actual = getFetchRequestArgBody ( [ 'http://example.com' , { method : 'POST' , body : jsonBody } ] ) ;
5050 expect ( actual ) . toEqual ( jsonBody ) ;
5151 } ) ;
5252
53- it ( 'should work with URLSearchParams' , ( ) => {
53+ it ( 'works with URLSearchParams' , ( ) => {
5454 const body = new URLSearchParams ( ) ;
5555 body . append ( 'name' , 'Anne' ) ;
5656 body . append ( 'age' , '32' ) ;
@@ -59,7 +59,7 @@ describe('getFetchRequestArgBody', () => {
5959 expect ( actual ) . toEqual ( body ) ;
6060 } ) ;
6161
62- it ( 'should work with FormData' , ( ) => {
62+ it ( 'works with FormData' , ( ) => {
6363 const body = new FormData ( ) ;
6464 body . append ( 'name' , 'Bob' ) ;
6565 body . append ( 'age' , '32' ) ;
@@ -68,13 +68,13 @@ describe('getFetchRequestArgBody', () => {
6868 expect ( actual ) . toEqual ( body ) ;
6969 } ) ;
7070
71- it ( 'should work with Blob' , ( ) => {
71+ it ( 'works with Blob' , ( ) => {
7272 const body = new Blob ( [ 'example' ] , { type : 'text/plain' } ) ;
7373 const actual = getFetchRequestArgBody ( [ 'http://example.com' , { method : 'POST' , body } ] ) ;
7474 expect ( actual ) . toEqual ( body ) ;
7575 } ) ;
7676
77- it ( 'should work with BufferSource (ArrayBufferView | ArrayBuffer)' , ( ) => {
77+ it ( 'works with BufferSource (ArrayBufferView | ArrayBuffer)' , ( ) => {
7878 const body = new Uint8Array ( [ 1 , 2 , 3 ] ) ;
7979 const actual = getFetchRequestArgBody ( [ 'http://example.com' , { method : 'POST' , body } ] ) ;
8080 expect ( actual ) . toEqual ( body ) ;
0 commit comments