Repository navigation
Expand file tree
/
Copy pathtest.http
More file actions
208 lines (157 loc) · 4.89 KB
/
Copy pathtest.http
File metadata and controls
208 lines (157 loc) · 4.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# API Test Suite
# generated by Claude Sonnet 4.5
### Test 1: Upload Script
POST http://localhost:8080/upload
Content-Type: application/json
{
"path": "test/javascript",
"language": "javascript",
"code": "return `Hello ${event.name}! This is JavaScript.`;"
}
###
### Test 2: Run Saved Script
POST http://localhost:8080/run/test/javascript
Content-Type: application/json
{
"input": "{\"name\": \"Pardn\"}"
}
###
### Test 3: Run Now - Python
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "python",
"code": "import json\nresult = {'sum': event['a'] + event['b'], 'product': event['a'] * event['b']}\nreturn result",
"input": "{\"a\": 10, \"b\": 5}"
}
###
### Test 4: Run Now - JavaScript
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "javascript",
"code": "const data = event.items.filter(x => x > 50); return {filtered: data, count: data.length};",
"input": "{\"items\": [20, 60, 45, 80, 30, 90]}"
}
###
### Test 5: Run Now - TypeScript
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "typescript",
"code": "interface User { name: string; age: number; } const users: User[] = event.users; const adults = users.filter(u => u.age >= 18); console.log(JSON.stringify({adults: adults.map(u => u.name)}));",
"input": "{\"users\": [{\"name\": \"Alice\", \"age\": 25}, {\"name\": \"Bob\", \"age\": 16}, {\"name\": \"Charlie\", \"age\": 30}]}"
}
###
### Test 6: Run Now - Error Handling (Syntax Error)
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "javascript",
"code": "console.log(undefined.property);",
"input": "{}",
"stream": true
}
###
### Test 7: Run Now - Timeout Test (should fail after 30s)
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "python",
"code": "import time\ntime.sleep(35)\nprint('done')",
"input": "{}"
}
###
### Test 8: Run with Specific Version
POST http://localhost:8080/run/test/javascript?version=1702467890
Content-Type: application/json
{
"name": "VersionTest"
}
###
### Test 9: Invalid Language
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "ruby",
"code": "puts 'Hello'",
"input": "{}"
}
###
### Test 10: Empty Code
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "python",
"code": "",
"input": "{}"
}
###
### Test 11: Complex Data Processing
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "javascript",
"code": "const transactions = event.transactions; const total = transactions.reduce((sum, t) => sum + t.amount, 0); const avg = total / transactions.length; return {total, average: avg.toFixed(2), count: transactions.length};",
"input": "{\"transactions\": [{\"id\": 1, \"amount\": 100}, {\"id\": 2, \"amount\": 250}, {\"id\": 3, \"amount\": 75}]}"
}
###
### Test 12: Run Now - Plain Text Output
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "python",
"code": "for i in range(5):\n return f'Line {i}'",
"input": "{}"
}
###
### Test 13: Stream - Python with Multiple Outputs
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "python",
"stream": true,
"code": "for i in range(5):\n print(f'Processing item {i}')\nimport time\ntime.sleep(0.5)\nreturn {'status': 'completed', 'count': 5}",
"input": "{}"
}
###
### Test 14: Stream - JavaScript Console Logs
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "javascript",
"stream": true,
"code": "console.log('Starting process...'); const items = event.items; items.forEach((item, i) => { console.log(`Processing ${item}`); }); return {processed: items.length};",
"input": "{\"items\": [\"apple\", \"banana\", \"cherry\"]}"
}
###
### Test 15: Stream - TypeScript with Progress
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "typescript",
"stream": true,
"code": "interface Task { id: number; name: string; } const tasks: Task[] = event.tasks; tasks.forEach(t => { console.log(`Task ${t.id}: ${t.name} - Started`); }); console.log('All tasks completed'); return {total: tasks.length};",
"input": "{\"tasks\": [{\"id\": 1, \"name\": \"Init\"}, {\"id\": 2, \"name\": \"Process\"}, {\"id\": 3, \"name\": \"Finish\"}]}"
}
###
### Test 16: Stream - Error in Stream
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "python",
"stream": true,
"code": "print('Step 1: OK')\nprint('Step 2: OK')\nraise Exception('Error at step 3')\nprint('Step 4: Not reached')",
"input": "{}"
}
###
### Test 17: Stream - Long Running Task
POST http://localhost:8080/run-now
Content-Type: application/json
{
"language": "python",
"stream": true,
"code": "import time\nfor i in range(10):\n print(f'Progress: {i*10}%')\n time.sleep(0.3)\nreturn 'Complete'",
"input": "{}"
}
###