astro/packages/create-astro/test/verify.test.js
Nate Moore e6e1de4f08
[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
2023-08-16 14:37:43 -05:00

41 lines
1.1 KiB
JavaScript

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')
});
});