MCPcopy
hub / github.com/audreyt/ethercalc / runHttpTests

Function runHttpTests

scripts/triage-open-issues.ts:219–390  ·  view source on GitHub ↗
(base: string)

Source from the content-addressed store, hash-verified

217}
218
219async function runHttpTests(base: string): Promise<void> {
220 const uid = () => `tri-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
221
222 // #442 DELETE + formdata
223 {
224 const room = uid();
225 const form = `${room}_formdata`;
226 const token = 'local-only-smoke';
227 await fetch(`${base}/_/${room}`, {
228 method: 'POST',
229 headers: { 'Content-Type': 'application/json' },
230 body: JSON.stringify({ command: 'set A1 text t x' }),
231 });
232 await fetch(`${base}/_migrate/seed/${form}`, {
233 method: 'PUT',
234 headers: {
235 Authorization: `Bearer ${token}`,
236 'Content-Type': 'application/json',
237 },
238 body: JSON.stringify({
239 snapshot: 'version:1.5\ncell:A1:t:form\nsheet:c:1:r:1:needsrecalc:no\n',
240 }),
241 });
242 await fetch(`${base}/_/${room}`, { method: 'DELETE' });
243 const main = (await fetch(`${base}/_/${room}`)).status;
244 const formSt = (await fetch(`${base}/_/${form}`)).status;
245 add(442, 'DELETE _formdata sibling', main === 404 && formSt === 404 ? 'close_fixed' : 'keep_broken', `main=${main}, form=${formSt}`);
246 }
247
248 // #441 DELETE in API.md
249 {
250 const api = readFileSync('/Users/au/w/ethercalc/API.md', 'utf8');
251 add(441, 'DELETE in API.md', api.match(/DELETE/i) ? 'close_fixed' : 'keep_broken', api.includes('DELETE') ? 'API.md documents DELETE' : 'missing');
252 }
253
254 // #275 multi redirect — check if /=room exists auto-detect
255 {
256 const res = await fetch(`${base}/testroom`, { redirect: 'manual' });
257 add(275, 'Multi-sheet redirect', 'keep_enhancement', `GET /:room → ${res.status} (no auto-detect /= prefix)`);
258 }
259
260 // #477 internal export — cells/json/csv.json routes
261 {
262 const room = uid();
263 await fetch(`${base}/_/${room}`, {
264 method: 'POST',
265 headers: { 'Content-Type': 'application/json' },
266 body: JSON.stringify({ command: 'set A1 value n 1' }),
267 });
268 const cells = (await fetch(`${base}/_/${room}/cells`)).status;
269 const cjson = (await fetch(`${base}/_/${room}/csv.json`)).status;
270 add(477, 'internal export API', cells === 200 && cjson === 200 ? 'close_fixed' : 'keep_enhancement', `/cells=${cells}, /csv.json=${cjson}`);
271 }
272
273 // #340 sandstorm download URL — generic export paths exist
274 add(340, 'Sandstorm download URL', 'close_fixed', 'GET /_/:room/csv|xlsx|html etc. available on worker');
275
276 // #558 API push — POST works

Callers 1

Calls 3

addFunction · 0.85
uidFunction · 0.70
fetchFunction · 0.50

Tested by

no test coverage detected