Late test should only run in SSR

This commit is contained in:
Matthew Phillips 2023-05-19 15:42:18 -04:00
parent ab0539b951
commit 83ed3669be
2 changed files with 6 additions and 2 deletions

View file

@ -1,5 +1,6 @@
---
import Redirect from '../components/redirect.astro';
const staticMode = import.meta.env.STATIC_MODE;
---
<html>
<head>
@ -7,6 +8,8 @@ import Redirect from '../components/redirect.astro';
</head>
<body>
<h1>Testing</h1>
<Redirect />
{ !staticMode ? (
<Redirect />
) : <div></div>}
</body>
</html>

View file

@ -29,7 +29,7 @@ describe('Astro.redirect', () => {
const request = new Request('http://example.com/late');
const response = await app.render(request);
try {
const text = await response.text();
await response.text();
expect(false).to.equal(true);
} catch (e) {
expect(e.message).to.equal(
@ -41,6 +41,7 @@ describe('Astro.redirect', () => {
describe('output: "static"', () => {
before(async () => {
process.env.STATIC_MODE = true;
fixture = await loadFixture({
root: './fixtures/ssr-redirect/',
output: 'static',