Late test should only run in SSR
This commit is contained in:
parent
ab0539b951
commit
83ed3669be
2 changed files with 6 additions and 2 deletions
|
@ -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>
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue