-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* test(netlify): add base fixture and prepare test * Update base.test.js * fix(netlify): test indentation --------- Co-authored-by: Alexander Niebuhr <alexander@nbhr.io>
- Loading branch information
1 parent
6ac9017
commit 3540bd2
Showing
6 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { expect } from 'chai'; | ||
import fs from 'fs/promises'; | ||
import { cli } from './test-utils.js'; | ||
import { fileURLToPath } from 'url'; | ||
|
||
const root = new URL('./fixtures/base/', import.meta.url).toString(); | ||
|
||
describe('Base', () => { | ||
before(async () => { | ||
await cli('build', '--root', fileURLToPath(root)); | ||
}); | ||
|
||
it('Path is prepended by base', async () => { | ||
const redir = await fs.readFile(new URL('./dist/_redirects', root), 'utf-8'); | ||
const baseRouteIndex = redir.indexOf('/test/ /.netlify/functions/entry 200'); | ||
const imageEndpoint = redir.indexOf('/test/_image /.netlify/functions/entry 200'); | ||
|
||
expect(baseRouteIndex).to.not.be.equal(-1); | ||
expect(imageEndpoint).to.not.be.equal(-1); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/netlify/test/functions/fixtures/base/astro.config.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import netlify from '@astrojs/netlify'; | ||
|
||
export default defineConfig({ | ||
base: "/test", | ||
trailingSlash: "always", | ||
output: 'server', | ||
adapter: netlify(), | ||
site: `http://example.com`, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "@test/netlify-base", | ||
"dependencies": { | ||
"@astrojs/netlify": "workspace:" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="astro/client" /> |
11 changes: 11 additions & 0 deletions
11
packages/netlify/test/functions/fixtures/base/src/pages/index.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
--- | ||
<html> | ||
<head> | ||
<title>Testing</title> | ||
</head> | ||
<body> | ||
<h1>Testing</h1> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.