Skip to content

Commit 8cbd5b2

Browse files
committed
chore: update tests
1 parent d31ceac commit 8cbd5b2

File tree

8 files changed

+285
-3
lines changed

8 files changed

+285
-3
lines changed

tests/Node16Test.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ class Node16Test extends Base
2222
protected array $expectedOutput = [
2323
...Base::PING_RESPONSE,
2424
...Base::FOO_RESPONSES,
25+
...Base::FOO_RESPONSES, // Object params
2526
...Base::BAR_RESPONSES,
27+
...Base::BAR_RESPONSES, // Object params
2628
...Base::GENERAL_RESPONSES,
2729
...Base::UPLOAD_RESPONSES,
30+
...Base::UPLOAD_RESPONSES, // Object params
2831
...Base::ENUM_RESPONSES,
2932
...Base::EXCEPTION_RESPONSES,
3033
...Base::OAUTH_RESPONSES,

tests/Node18Test.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ class Node18Test extends Base
2222
protected array $expectedOutput = [
2323
...Base::PING_RESPONSE,
2424
...Base::FOO_RESPONSES,
25+
...Base::FOO_RESPONSES, // Object params
2526
...Base::BAR_RESPONSES,
27+
...Base::BAR_RESPONSES, // Object params
2628
...Base::GENERAL_RESPONSES,
2729
...Base::UPLOAD_RESPONSES,
30+
...Base::UPLOAD_RESPONSES, // Object params
2831
...Base::ENUM_RESPONSES,
2932
...Base::EXCEPTION_RESPONSES,
3033
...Base::OAUTH_RESPONSES,

tests/Node20Test.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ class Node20Test extends Base
2222
protected array $expectedOutput = [
2323
...Base::PING_RESPONSE,
2424
...Base::FOO_RESPONSES,
25+
...Base::FOO_RESPONSES, // Object params
2526
...Base::BAR_RESPONSES,
27+
...Base::BAR_RESPONSES, // Object params
2628
...Base::GENERAL_RESPONSES,
2729
...Base::UPLOAD_RESPONSES,
30+
...Base::UPLOAD_RESPONSES, // Object params
2831
...Base::ENUM_RESPONSES,
2932
...Base::EXCEPTION_RESPONSES,
3033
...Base::OAUTH_RESPONSES,

tests/WebChromiumTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ class WebChromiumTest extends Base
2323
protected array $expectedOutput = [
2424
...Base::PING_RESPONSE,
2525
...Base::FOO_RESPONSES,
26+
...Base::FOO_RESPONSES, // Object params
2627
...Base::BAR_RESPONSES,
28+
...Base::BAR_RESPONSES, // Object params
2729
...Base::GENERAL_RESPONSES,
2830
...Base::UPLOAD_RESPONSES,
31+
...Base::UPLOAD_RESPONSES, // Object params
2932
...Base::ENUM_RESPONSES,
3033
...Base::EXCEPTION_RESPONSES,
3134
...Base::REALTIME_RESPONSES,

tests/WebNodeTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ class WebNodeTest extends Base
2424
protected array $expectedOutput = [
2525
...Base::PING_RESPONSE,
2626
...Base::FOO_RESPONSES,
27+
...Base::FOO_RESPONSES, // Object params
2728
...Base::BAR_RESPONSES,
29+
...Base::BAR_RESPONSES, // Object params
2830
...Base::GENERAL_RESPONSES,
2931
...Base::UPLOAD_RESPONSES,
3032
...Base::ENUM_RESPONSES,

tests/languages/node/test.js

Lines changed: 114 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ async function start() {
3030
console.log('\nTest Started');
3131

3232
// Ping
33-
3433
response = await client.ping();
3534
console.log(response.result);
3635

3736
// Foo
38-
3937
response = await foo.get('string', 123, ['string in array']);
4038
console.log(response.result);
4139

@@ -51,8 +49,43 @@ async function start() {
5149
response = await foo.delete('string', 123, ['string in array']);
5250
console.log(response.result);
5351

54-
// Bar
52+
// Foo (Object params)
53+
response = await foo.get({
54+
x: 'string',
55+
y: 123,
56+
z: ['string in array']
57+
});
58+
console.log(response.result);
59+
60+
response = await foo.post({
61+
x: 'string',
62+
y: 123,
63+
z: ['string in array']
64+
});
65+
console.log(response.result);
66+
67+
response = await foo.put({
68+
x: 'string',
69+
y: 123,
70+
z: ['string in array']
71+
});
72+
console.log(response.result);
5573

74+
response = await foo.patch({
75+
x: 'string',
76+
y: 123,
77+
z: ['string in array']
78+
});
79+
console.log(response.result);
80+
81+
response = await foo.delete({
82+
x: 'string',
83+
y: 123,
84+
z: ['string in array']
85+
});
86+
console.log(response.result);
87+
88+
// Bar
5689
response = await bar.get('string', 123, ['string in array']);
5790
console.log(response.result);
5891

@@ -68,9 +101,47 @@ async function start() {
68101
response = await bar.delete('string', 123, ['string in array']);
69102
console.log(response.result);
70103

104+
// Bar (Object params)
105+
response = await bar.get({
106+
required: 'string',
107+
xdefault: 123,
108+
z: ['string in array']
109+
});
110+
console.log(response.result);
111+
112+
response = await bar.post({
113+
required: 'string',
114+
xdefault: 123,
115+
z: ['string in array']
116+
});
117+
console.log(response.result);
118+
119+
response = await bar.put({
120+
required: 'string',
121+
xdefault: 123,
122+
z: ['string in array']
123+
});
124+
console.log(response.result);
125+
126+
response = await bar.patch({
127+
required: 'string',
128+
xdefault: 123,
129+
z: ['string in array']
130+
});
131+
console.log(response.result);
132+
133+
response = await bar.delete({
134+
required: 'string',
135+
xdefault: 123,
136+
z: ['string in array']
137+
});
138+
console.log(response.result);
139+
140+
// General
71141
response = await general.redirect();
72142
console.log(response.result);
73143

144+
// Upload
74145
response = await general.upload('string', 123, ['string in array'], InputFile.fromPath(__dirname + '/../../resources/file.png', 'file.png'));
75146
console.log(response.result);
76147

@@ -85,6 +156,46 @@ async function start() {
85156
response = await general.upload('string', 123, ['string in array'], InputFile.fromBuffer(largeBuffer, 'large_file.mp4'))
86157
console.log(response.result);
87158

159+
// Upload (Object params)
160+
response = await general.upload({
161+
x: 'string',
162+
y: 123,
163+
z: ['string in array'],
164+
file: InputFile.fromPath(__dirname + '/../../resources/file.png', 'file.png')
165+
});
166+
console.log(response.result);
167+
168+
response = await general.upload({
169+
x: 'string',
170+
y: 123,
171+
z: ['string in array'],
172+
file: InputFile.fromPath(__dirname + '/../../resources/large_file.mp4', 'large_file.mp4')
173+
});
174+
console.log(response.result);
175+
176+
response = await general.upload({
177+
x: 'string',
178+
y: 123,
179+
z: ['string in array'],
180+
file: InputFile.fromBuffer(smallBuffer, 'file.png'),
181+
onProgress: (progress) => {
182+
// nothing
183+
}
184+
});
185+
console.log(response.result);
186+
187+
response = await general.upload({
188+
x: 'string',
189+
y: 123,
190+
z: ['string in array'],
191+
file: InputFile.fromBuffer(largeBuffer, 'large_file.mp4'),
192+
onProgress: (progress) => {
193+
// nothing
194+
}
195+
});
196+
console.log(response.result);
197+
198+
// Enum
88199
response = await general.enum(MockType.First);
89200
console.log(response.result);
90201

tests/languages/web/index.html

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,42 @@
5757
response = await foo.delete('string', 123, ["string in array"]);
5858
console.log(response.result);
5959

60+
// Foo (Object params)
61+
response = await foo.get({
62+
x: 'string',
63+
y: 123,
64+
z: ['string in array']
65+
});
66+
console.log(response.result);
67+
68+
response = await foo.post({
69+
x: 'string',
70+
y: 123,
71+
z: ['string in array']
72+
});
73+
console.log(response.result);
74+
75+
response = await foo.put({
76+
x: 'string',
77+
y: 123,
78+
z: ['string in array']
79+
});
80+
console.log(response.result);
81+
82+
response = await foo.patch({
83+
x: 'string',
84+
y: 123,
85+
z: ['string in array']
86+
});
87+
console.log(response.result);
88+
89+
response = await foo.delete({
90+
x: 'string',
91+
y: 123,
92+
z: ['string in array']
93+
});
94+
console.log(response.result);
95+
6096
// Bar
6197
response = await bar.get("string", 123, ["string in array"]);
6298
console.log(response.result);
@@ -73,6 +109,42 @@
73109
response = await bar.delete("string", 123, ["string in array"]);
74110
console.log(response.result);
75111

112+
// Bar (Object params)
113+
response = await bar.get({
114+
required: 'string',
115+
xdefault: 123,
116+
z: ['string in array']
117+
});
118+
console.log(response.result);
119+
120+
response = await bar.post({
121+
required: 'string',
122+
xdefault: 123,
123+
z: ['string in array']
124+
});
125+
console.log(response.result);
126+
127+
response = await bar.put({
128+
required: 'string',
129+
xdefault: 123,
130+
z: ['string in array']
131+
});
132+
console.log(response.result);
133+
134+
response = await bar.patch({
135+
required: 'string',
136+
xdefault: 123,
137+
z: ['string in array']
138+
});
139+
console.log(response.result);
140+
141+
response = await bar.delete({
142+
required: 'string',
143+
xdefault: 123,
144+
z: ['string in array']
145+
});
146+
console.log(response.result);
147+
76148
// General
77149
response = await general.redirect();
78150
console.log(response.result);
@@ -85,6 +157,7 @@
85157
);
86158
console.log(response.result);
87159

160+
// Upload
88161
response = await general.upload(
89162
"string",
90163
123,
@@ -96,6 +169,18 @@
96169
console.log('POST:/v1/mock/tests/general/upload:passed'); // Skip InputFile tests
97170
console.log('POST:/v1/mock/tests/general/upload:passed'); // Skip InputFile tests
98171

172+
// Upload (Object params)
173+
response = await general.upload({
174+
x: 'string',
175+
y: 123,
176+
z: ['string in array'],
177+
file: document.getElementById("file").files[0]
178+
});
179+
console.log(response.result);
180+
181+
console.log('POST:/v1/mock/tests/general/upload:passed'); // Skip InputFile tests
182+
console.log('POST:/v1/mock/tests/general/upload:passed'); // Skip InputFile tests
183+
99184
response = await general.enum(MockType.First);
100185
console.log(response.result);
101186

0 commit comments

Comments
 (0)