Skip to content

Commit

Permalink
finalize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Jan 25, 2025
1 parent 72887e6 commit 0c46cbf
Show file tree
Hide file tree
Showing 5 changed files with 263 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,25 +238,26 @@ routes.set('/override-content-length/response/method/true', async () => {
return responseMethod(true);
});

// TODO: uncomment when we have an implementation of Response.prototype.clone
// async function responseClone(setManualFramingHeaders) {
// let response = new Response("meow", {
// backend: "httpme",
// method: "POST",
// body: "meow",
// setManualFramingHeaders,
// headers: {
// "transfer-encoding": "chunked"
// }
// });
// response = response.clone();
// return response;
// }
async function responseClone(setManualFramingHeaders) {
let response = new Response('meow', {
backend: 'httpme',
method: 'POST',
body: 'meow',
setManualFramingHeaders,
headers: {
'transfer-encoding': 'chunked',
},
});
response = response.clone();
return response;
}

// routes.set("/override-content-length/response/clone/true", async () => {
// return responseClone(true);
// });
// TODO: implement Response.clone
routes.set('/override-content-length/response/clone/true', async () => {
return responseClone(true);
});

// routes.set("/override-content-length/response/clone/false", async () => {
// return responseClone(false);
// });
// TODO: implement Response.clone
routes.set('/override-content-length/response/clone/false', async () => {
return responseClone(false);
});
21 changes: 8 additions & 13 deletions integration-tests/js-compute/fixtures/app/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,6 @@
"body": "hello world!"
}
},

"GET /tee/error": {
"downstream_request": {
"method": "GET",
Expand All @@ -1268,7 +1267,6 @@
"body": "Error: TypeError"
}
},

"GET /override-content-length/request/init/object-literal/true": {
"environments": ["compute"],
"downstream_response": {
Expand All @@ -1283,7 +1281,6 @@
"body": "ok"
}
},

"GET /override-content-length/request/clone/true": {
"environments": ["compute"],
"downstream_response": {
Expand All @@ -1298,7 +1295,6 @@
"body": "ok"
}
},

"GET /override-content-length/fetch/init/object-literal/true": {
"environments": ["compute"],
"downstream_response": {
Expand All @@ -1313,7 +1309,14 @@
"body": "ok"
}
},

"/override-content-length/response/clone/true": {
"skip": true,
"environments": ["compute"]
},
"/override-content-length/response/clone/false": {
"skip": true,
"environments": ["compute"]
},
"GET /override-content-length/response/init/object-literal/true": {
"environments": ["compute"],
"downstream_response": {
Expand All @@ -1322,15 +1325,13 @@
"headers": { "content-length": "4" }
}
},

"GET /override-content-length/response/init/object-literal/false": {
"environments": ["compute"],
"downstream_response": {
"status": 200,
"body": "meow"
}
},

"GET /override-content-length/response/init/response-instance/true": {
"environments": ["compute"],
"downstream_response": {
Expand All @@ -1339,27 +1340,23 @@
"headers": { "content-length": "4" }
}
},

"GET /override-content-length/response/init/response-instance/false": {
"environments": ["compute"],
"downstream_response": {
"status": 200,
"body": "meow"
}
},

"GET /override-content-length/response/method/false": {
"environments": ["compute"]
},

"GET /override-content-length/response/method/true": {
"environments": ["compute"],
"downstream_response": {
"status": 200,
"headers": { "content-length": "11" }
}
},

"GET /headers/non-ascii-latin1-field-value": {
"downstream_response": {
"status": 200,
Expand Down Expand Up @@ -2321,7 +2318,6 @@
"GET /transaction-cache-entry/cancel/called-twice-throws": {
"environments": ["compute"]
},

"GET /rate-counter/interface": {
"downstream_response": {
"status": 200,
Expand Down Expand Up @@ -2730,7 +2726,6 @@
"body": "ok"
}
},

"GET /device/interface": {
"downstream_response": {
"status": 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ routes.set('/backend/timeout', async () => {
'/implicit-dynamic-backend/dynamic-backends-disabled',
async () => {
allowDynamicBackends(false);
await assertRejects(() => fetch('https://http-me.glitch.me/headers'));
await assertRejects(() =>
fetch('https://http-me.glitch.me/headers', {
cacheOverride: 'pass',
}),
);
},
);
routes.set(
Expand All @@ -62,7 +66,9 @@ routes.set('/backend/timeout', async () => {
strictEqual(evt.request.backend, undefined);
strictEqual(new Response('test').backend, undefined);
await assertResolves(async () => {
const res = await fetch('https://http-me.glitch.me/headers');
const res = await fetch('https://http-me.glitch.me/headers', {
cacheOverride: 'pass',
});
strictEqual(res.backend.name, 'http-me.glitch.me');
strictEqual(res.backend.isSSL, true);
});
Expand Down
Loading

0 comments on commit 0c46cbf

Please sign in to comment.