summaryrefslogtreecommitdiff
path: root/packages/integrations/node/test/prerender.test.js
diff options
context:
space:
mode:
authorGravatar Arsh <69170106+lilnasy@users.noreply.github.com> 2024-02-01 21:24:21 +0000
committerGravatar GitHub <noreply@github.com> 2024-02-01 16:24:21 -0500
commit44674418965d658733d3602668a9354e18f8ef89 (patch)
tree3954c5e37041c6e741d2e7d22239652c3e006edb /packages/integrations/node/test/prerender.test.js
parentb956149b2805fdd977d20e267f05c6c4872e2704 (diff)
downloadastro-44674418965d658733d3602668a9354e18f8ef89.tar.gz
astro-44674418965d658733d3602668a9354e18f8ef89.tar.zst
astro-44674418965d658733d3602668a9354e18f8ef89.zip
fix(NodeApp): fix responses with null bodies never completing (#9931)
* fix(NodeApp): fix responses with null bodies never completing * add changeset * add test * chore(tests): restore correct assertions * adjust incorrect test * added Astro.redirect and Response.redirect test cases * updated incorrect HTTP status * adjust api-routes.test.js after cherry-pick * bup markdoc test timeout --------- Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> Co-authored-by: Friedemann Sommer <friedemannsommer@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/node/test/prerender.test.js')
-rw-r--r--packages/integrations/node/test/prerender.test.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/packages/integrations/node/test/prerender.test.js b/packages/integrations/node/test/prerender.test.js
index 597794be0..7036c913c 100644
--- a/packages/integrations/node/test/prerender.test.js
+++ b/packages/integrations/node/test/prerender.test.js
@@ -82,8 +82,7 @@ describe('Prerendering', () => {
});
const html = await res.text();
const $ = cheerio.load(html);
- assert.equal(res.status, 301);
- assert.equal(res.headers.get('location'), '/some-base/two/');
+ assert.equal(res.status, 200);
assert.equal($('h1').text(), 'Two');
});
});
@@ -171,8 +170,8 @@ describe('Prerendering', () => {
const html = await res.text();
const $ = cheerio.load(html);
- expect(res.status).to.equal(200);
- expect($('h1').text()).to.equal('One');
+ assert.equal(res.status, 200);
+ assert.equal($('h1').text(), 'One');
});
it('Can render prerendered route', async () => {
@@ -180,8 +179,8 @@ describe('Prerendering', () => {
const html = await res.text();
const $ = cheerio.load(html);
- expect(res.status).to.equal(200);
- expect($('h1').text()).to.equal('Two');
+ assert.equal(res.status, 200);
+ assert.equal($('h1').text(), 'Two');
});
});
});
@@ -252,8 +251,9 @@ describe('Hybrid rendering', () => {
const res = await fetch(`http://${server.host}:${server.port}/some-base/one`, {
redirect: 'manual',
});
- assert.equal(res.status, 301);
- assert.equal(res.headers.get('location'), '/some-base/one/');
+ const html = await res.text();
+ const $ = cheerio.load(html);
+ assert.equal(res.status, 200);
assert.equal($('h1').text(), 'One');
});
});
@@ -342,8 +342,8 @@ describe('Hybrid rendering', () => {
const html = await res.text();
const $ = cheerio.load(html);
- expect(res.status).to.equal(200);
- expect($('h1').text()).to.equal('shared');
+ assert.equal(res.status, 200);
+ assert.equal($('h1').text(), 'shared');
});
});
});