2024-02-13 09:41:59 -05:00
|
|
|
import assert from 'node:assert/strict';
|
|
|
|
import { describe, it } from 'node:test';
|
|
|
|
import { verify } from '../dist/index.js';
|
2023-08-16 14:37:43 -05:00
|
|
|
import { setup } from './utils.js';
|
|
|
|
|
2024-02-13 09:41:59 -05:00
|
|
|
describe('verify', async () => {
|
2023-08-16 14:37:43 -05:00
|
|
|
const fixture = setup();
|
|
|
|
const exit = (code) => {
|
|
|
|
throw code;
|
2023-08-16 14:39:52 -05:00
|
|
|
};
|
2023-08-16 14:37:43 -05:00
|
|
|
|
|
|
|
it('basics', async () => {
|
|
|
|
const context = { template: 'basics', exit };
|
|
|
|
await verify(context);
|
2024-02-13 09:41:59 -05:00
|
|
|
assert.equal(fixture.messages().length, 0, 'Did not expect `verify` to log any messages');
|
2023-08-16 14:37:43 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('missing', async () => {
|
|
|
|
const context = { template: 'missing', exit };
|
|
|
|
let err = null;
|
|
|
|
try {
|
|
|
|
await verify(context);
|
|
|
|
} catch (e) {
|
|
|
|
err = e;
|
|
|
|
}
|
2024-02-13 09:41:59 -05:00
|
|
|
assert.equal(err, 1);
|
|
|
|
assert.ok(!fixture.hasMessage('Template missing does not exist!'));
|
2023-08-16 14:37:43 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('starlight', async () => {
|
|
|
|
const context = { template: 'starlight', exit };
|
|
|
|
await verify(context);
|
2024-02-13 09:41:59 -05:00
|
|
|
assert.equal(fixture.messages().length, 0, 'Did not expect `verify` to log any messages');
|
2023-08-16 14:37:43 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('starlight/tailwind', async () => {
|
|
|
|
const context = { template: 'starlight/tailwind', exit };
|
|
|
|
await verify(context);
|
2024-02-13 09:41:59 -05:00
|
|
|
assert.equal(fixture.messages().length, 0, 'Did not expect `verify` to log any messages');
|
2023-08-16 14:37:43 -05:00
|
|
|
});
|
|
|
|
});
|