diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/astro-expr.test.js | 18 | ||||
-rw-r--r-- | test/fixtures/astro-expr/astro.config.mjs | 6 | ||||
-rw-r--r-- | test/fixtures/astro-expr/astro/components/Color.jsx | 5 | ||||
-rw-r--r-- | test/fixtures/astro-expr/astro/pages/index.astro | 22 |
4 files changed, 51 insertions, 0 deletions
diff --git a/test/astro-expr.test.js b/test/astro-expr.test.js new file mode 100644 index 000000000..c9aa414dd --- /dev/null +++ b/test/astro-expr.test.js @@ -0,0 +1,18 @@ +import { suite } from 'uvu'; +import * as assert from 'uvu/assert'; +import { doc } from './test-utils.js'; +import { setup } from './helpers.js'; + +const Expressions = suite('Expressions'); + +setup(Expressions, './fixtures/astro-expr'); + +Expressions('Can load page', async ({ runtime }) => { + const result = await runtime.load('/'); + + console.log(result) + assert.equal(result.statusCode, 200); + console.log(result.contents); +}); + +Expressions.run(); diff --git a/test/fixtures/astro-expr/astro.config.mjs b/test/fixtures/astro-expr/astro.config.mjs new file mode 100644 index 000000000..80d0860c3 --- /dev/null +++ b/test/fixtures/astro-expr/astro.config.mjs @@ -0,0 +1,6 @@ + +export default { + extensions: { + '.jsx': 'preact' + } +}
\ No newline at end of file diff --git a/test/fixtures/astro-expr/astro/components/Color.jsx b/test/fixtures/astro-expr/astro/components/Color.jsx new file mode 100644 index 000000000..13a5049aa --- /dev/null +++ b/test/fixtures/astro-expr/astro/components/Color.jsx @@ -0,0 +1,5 @@ +import { h } from 'preact'; + +export default function({ name }) { + return <div>{name}</div> +}
\ No newline at end of file diff --git a/test/fixtures/astro-expr/astro/pages/index.astro b/test/fixtures/astro-expr/astro/pages/index.astro new file mode 100644 index 000000000..f0a4d2ab0 --- /dev/null +++ b/test/fixtures/astro-expr/astro/pages/index.astro @@ -0,0 +1,22 @@ +--- +import Color from '../components/Color.jsx'; + +let title = 'My Site'; + +const colors = ['red', 'yellow', 'blue'] +--- + +<html lang="en"> +<head> + <title>My site</title> +</head> +<body> + <h1>{title}</h1> + + {colors.map(color => ( + <div> + <Color name={color} /> + </div> + ))} +</body> +</html>
\ No newline at end of file |