Skip to content

Commit 21cc9aa

Browse files
committed
updated js tests
1 parent 857307d commit 21cc9aa

File tree

3 files changed

+126
-84
lines changed

3 files changed

+126
-84
lines changed

test/codegen/js_axios_codegen_test.dart

Lines changed: 70 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ axios(config)
3737
url: 'https://api.apidash.dev/country/data',
3838
method: 'get',
3939
params: {
40-
"code": "US"
40+
"code": [
41+
"US"
42+
]
4143
}
4244
};
4345
@@ -64,7 +66,10 @@ axios(config)
6466
url: 'https://api.apidash.dev/country/data',
6567
method: 'get',
6668
params: {
67-
"code": "IND"
69+
"code": [
70+
"IND",
71+
"US"
72+
]
6873
}
6974
};
7075
@@ -91,11 +96,21 @@ axios(config)
9196
url: 'https://api.apidash.dev/humanize/social',
9297
method: 'get',
9398
params: {
94-
"num": "8700000",
95-
"digits": "3",
96-
"system": "SS",
97-
"add_space": "true",
98-
"trailing_zeros": "true"
99+
"num": [
100+
"8700000"
101+
],
102+
"digits": [
103+
"3"
104+
],
105+
"system": [
106+
"SS"
107+
],
108+
"add_space": [
109+
"true"
110+
],
111+
"trailing_zeros": [
112+
"true"
113+
]
99114
}
100115
};
101116
@@ -149,7 +164,9 @@ axios(config)
149164
url: 'https://api.github.com/repos/foss42/apidash',
150165
method: 'get',
151166
params: {
152-
"raw": "true"
167+
"raw": [
168+
"true"
169+
]
153170
},
154171
headers: {
155172
"User-Agent": "Test Agent"
@@ -203,7 +220,9 @@ axios(config)
203220
url: 'https://api.github.com/repos/foss42/apidash',
204221
method: 'get',
205222
params: {
206-
"raw": "true"
223+
"raw": [
224+
"true"
225+
]
207226
},
208227
headers: {
209228
"User-Agent": "Test Agent"
@@ -233,8 +252,12 @@ axios(config)
233252
url: 'https://api.apidash.dev/humanize/social',
234253
method: 'get',
235254
params: {
236-
"num": "8700000",
237-
"add_space": "true"
255+
"num": [
256+
"8700000"
257+
],
258+
"add_space": [
259+
"true"
260+
]
238261
}
239262
};
240263
@@ -288,8 +311,12 @@ axios(config)
288311
url: 'https://api.apidash.dev/humanize/social',
289312
method: 'get',
290313
params: {
291-
"num": "8700000",
292-
"digits": "3"
314+
"num": [
315+
"8700000"
316+
],
317+
"digits": [
318+
"3"
319+
]
293320
},
294321
headers: {
295322
"User-Agent": "Test Agent"
@@ -609,8 +636,12 @@ axios(config)
609636
url: 'https://api.apidash.dev/io/form',
610637
method: 'post',
611638
params: {
612-
"size": "2",
613-
"len": "3"
639+
"size": [
640+
"2"
641+
],
642+
"len": [
643+
"3"
644+
]
614645
},
615646
headers: {
616647
"Content-Type": "multipart/form-data"
@@ -647,8 +678,12 @@ const config = {
647678
url: 'https://api.apidash.dev/io/img',
648679
method: 'post',
649680
params: {
650-
"size": "2",
651-
"len": "3"
681+
"size": [
682+
"2"
683+
],
684+
"len": [
685+
"3"
686+
]
652687
},
653688
headers: {
654689
"Content-Type": "multipart/form-data",
@@ -682,11 +717,13 @@ axios(config)
682717

683718
group('PUT Request', () {
684719
test('PUT 1', () {
685-
const expectedCode = r"""const config = {
720+
const expectedCode = r"""
721+
const config = {
686722
url: 'https://reqres.in/api/users/2',
687723
method: 'put',
688724
headers: {
689-
"Content-Type": "application/json"
725+
"Content-Type": "application/json",
726+
"x-api-key": "reqres-free-v1"
690727
},
691728
data: "{\n\"name\": \"morpheus\",\n\"job\": \"zion resident\"\n}"
692729
};
@@ -712,11 +749,13 @@ axios(config)
712749

713750
group('PATCH Request', () {
714751
test('PATCH 1', () {
715-
const expectedCode = r"""const config = {
752+
const expectedCode = r"""
753+
const config = {
716754
url: 'https://reqres.in/api/users/2',
717755
method: 'patch',
718756
headers: {
719-
"Content-Type": "application/json"
757+
"Content-Type": "application/json",
758+
"x-api-key": "reqres-free-v1"
720759
},
721760
data: "{\n\"name\": \"marfeus\",\n\"job\": \"accountant\"\n}"
722761
};
@@ -742,9 +781,13 @@ axios(config)
742781

743782
group('DELETE Request', () {
744783
test('DELETE 1', () {
745-
const expectedCode = r"""const config = {
784+
const expectedCode = r"""
785+
const config = {
746786
url: 'https://reqres.in/api/users/2',
747-
method: 'delete'
787+
method: 'delete',
788+
headers: {
789+
"x-api-key": "reqres-free-v1"
790+
}
748791
};
749792
750793
axios(config)
@@ -766,11 +809,13 @@ axios(config)
766809
});
767810

768811
test('DELETE 2', () {
769-
const expectedCode = r"""const config = {
812+
const expectedCode = r"""
813+
const config = {
770814
url: 'https://reqres.in/api/users/2',
771815
method: 'delete',
772816
headers: {
773-
"Content-Type": "application/json"
817+
"Content-Type": "application/json",
818+
"x-api-key": "reqres-free-v1"
774819
},
775820
data: "{\n\"name\": \"marfeus\",\n\"job\": \"accountant\"\n}"
776821
};

0 commit comments

Comments
 (0)