diff options
author | 2023-08-16 14:37:43 -0500 | |
---|---|---|
committer | 2023-08-16 14:37:43 -0500 | |
commit | e6e1de4f08ddba3a7703136a81f275de1976dc9e (patch) | |
tree | cf053566e682cb866e028d0dbbc11614cca7660f /packages/create-astro/test/verify.test.js | |
parent | 42ed85b3e263bb5e28725395924d0b595e1e0041 (diff) | |
download | astro-e6e1de4f08ddba3a7703136a81f275de1976dc9e.tar.gz astro-e6e1de4f08ddba3a7703136a81f275de1976dc9e.tar.zst astro-e6e1de4f08ddba3a7703136a81f275de1976dc9e.zip |
[create-astro] verify connectivity and --template (#8102)
* feat(create-astro): verify that --template exists
* feat: verify internet connectivity
* chore: skip connectivity check on --dry-run
* chore: fix lint
Diffstat (limited to '')
-rw-r--r-- | packages/create-astro/test/verify.test.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/packages/create-astro/test/verify.test.js b/packages/create-astro/test/verify.test.js new file mode 100644 index 000000000..6b1ab1344 --- /dev/null +++ b/packages/create-astro/test/verify.test.js @@ -0,0 +1,41 @@ +import { expect } from 'chai'; + +import { verify } from '../dist/index.js'; +import { setup } from './utils.js'; + +describe('verify', () => { + const fixture = setup(); + const exit = (code) => { + throw code; + } + + it('basics', async () => { + const context = { template: 'basics', exit }; + await verify(context); + expect(fixture.messages().length).to.equal(0, 'Did not expect `verify` to log any messages') + }); + + it('missing', async () => { + const context = { template: 'missing', exit }; + let err = null; + try { + await verify(context); + } catch (e) { + err = e; + } + expect(err).to.eq(1); + expect(fixture.hasMessage('Template missing does not exist!')); + }); + + it('starlight', async () => { + const context = { template: 'starlight', exit }; + await verify(context); + expect(fixture.messages().length).to.equal(0, 'Did not expect `verify` to log any messages') + }); + + it('starlight/tailwind', async () => { + const context = { template: 'starlight/tailwind', exit }; + await verify(context); + expect(fixture.messages().length).to.equal(0, 'Did not expect `verify` to log any messages') + }); +}); |