summaryrefslogtreecommitdiff
path: root/packages/astro/test/astro-markdown.test.js
diff options
context:
space:
mode:
authorGravatar hippotastic <6137925+hippotastic@users.noreply.github.com> 2022-05-30 18:18:43 +0200
committerGravatar GitHub <noreply@github.com> 2022-05-30 12:18:43 -0400
commit75fa58f13fff27a872b7b85948d65e82d9e7a8eb (patch)
tree5ba6c5b59d9f6e7fb3ecd2349a042551c45c4a81 /packages/astro/test/astro-markdown.test.js
parent429b65d60bb64973f1e5867cc58f1fe07bada952 (diff)
downloadastro-75fa58f13fff27a872b7b85948d65e82d9e7a8eb.tar.gz
astro-75fa58f13fff27a872b7b85948d65e82d9e7a8eb.tar.zst
astro-75fa58f13fff27a872b7b85948d65e82d9e7a8eb.zip
Fix using Vite env var names in Markdown (#3412) (#3471)
Diffstat (limited to '')
-rw-r--r--packages/astro/test/astro-markdown.test.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/astro/test/astro-markdown.test.js b/packages/astro/test/astro-markdown.test.js
index 181ca56e9..6a5ef5846 100644
--- a/packages/astro/test/astro-markdown.test.js
+++ b/packages/astro/test/astro-markdown.test.js
@@ -256,4 +256,21 @@ describe('Astro Markdown', () => {
`<h2 id="with-components">With components</h2>\n<h3 id="non-hydrated">Non-hydrated</h3>\n<Hello name="Astro Naut" />\n<h3 id="hydrated">Hydrated</h3>\n<Counter client:load />\n<SvelteButton client:load />`
);
});
+
+ it('Allows referencing Vite env var names in markdown (#3412)', async () => {
+ const html = await fixture.readFile('/vite-env-vars/index.html');
+ const $ = cheerio.load(html);
+
+ // test 1: referencing an existing var name
+ expect($('code').eq(0).text()).to.equal('import.meta.env.SITE');
+ expect($('li').eq(0).text()).to.equal('import.meta.env.SITE');
+ expect($('code').eq(2).text()).to.contain('site: import.meta.env.SITE');
+ expect($('blockquote').text()).to.contain('import.meta.env.SITE');
+
+ // test 2: referencing a non-existing var name
+ expect($('code').eq(1).text()).to.equal('import.meta.env.TITLE');
+ expect($('li').eq(1).text()).to.equal('import.meta.env.TITLE');
+ expect($('code').eq(2).text()).to.contain('title: import.meta.env.TITLE');
+ expect($('blockquote').text()).to.contain('import.meta.env.TITLE');
+ });
});