diff options
author | 2022-06-24 04:04:10 +0900 | |
---|---|---|
committer | 2022-06-23 14:04:10 -0500 | |
commit | 446f8c4f13de04324697e958af027ac8943a039b (patch) | |
tree | cf4b9c7046d285c76ec5ea3ff00cf9f809ca1a0f /packages/astro/test/static-build-dir.test.js | |
parent | e990b9f42d9099868d4e764076bba4cfe29b2b28 (diff) | |
download | astro-446f8c4f13de04324697e958af027ac8943a039b.tar.gz astro-446f8c4f13de04324697e958af027ac8943a039b.tar.zst astro-446f8c4f13de04324697e958af027ac8943a039b.zip |
Added test for dir parameter in astro:build:done. (#3649)
* Added test for dir in astro:build:done
* Added changeset
* Change pathname for Windows
* Change changeset generated file summary
* Eliminate testing of branches by os
* Eliminate OS dependence
* Change changeset generated file summary
* Using fileURLToPath
* Cross-platform fixes.
* Use posix for everything.
* Pass an empty string for relative from
* Use path.join for the correct value
* Update packages/astro/test/static-build-dir.test.js
* Update packages/astro/test/static-build-dir.test.js
* Update packages/astro/test/static-build-dir.test.js
* Remove trailing slash
* add toString
* fix syntax error
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Diffstat (limited to 'packages/astro/test/static-build-dir.test.js')
-rw-r--r-- | packages/astro/test/static-build-dir.test.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/packages/astro/test/static-build-dir.test.js b/packages/astro/test/static-build-dir.test.js new file mode 100644 index 000000000..d09756af2 --- /dev/null +++ b/packages/astro/test/static-build-dir.test.js @@ -0,0 +1,29 @@ +import { expect } from 'chai'; +import { loadFixture } from './test-utils.js'; + +describe('Static build: dir takes the URL path to the output directory', () => { + /** @type {URL} */ + let checkDir; + before(async () => { + const fixture = await loadFixture({ + root: './fixtures/static-build-dir/', + integrations: [ + { + name: '@astrojs/dir', + hooks: { + 'astro:build:done': ({ dir }) => { + checkDir = dir; + }, + }, + }, + ], + }); + await fixture.build(); + }); + it('dir takes the URL path to the output directory', async () => { + const removeTrailingSlash = (str) => str.replace(/\/$/, ''); + expect(removeTrailingSlash(checkDir.toString())).to.be.equal( + removeTrailingSlash(new URL('./fixtures/static-build-dir/dist', import.meta.url).toString()) + ); + }); +}); |