verify.test.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import assert from 'node:assert/strict';
  2. import { describe, it } from 'node:test';
  3. import { setup } from './utils.js';
  4. import { verify } from '../dist/index.js';
  5. describe('verify', async () => {
  6. const fixture = setup();
  7. const exit = (code) => {
  8. throw code;
  9. };
  10. it('basics', async () => {
  11. const context = { template: 'basics', exit };
  12. await verify(context);
  13. assert.equal(fixture.messages().length, 0, 'Did not expect `verify` to log any messages');
  14. });
  15. it('missing', async () => {
  16. const context = { template: 'missing', exit };
  17. let err = null;
  18. try {
  19. await verify(context);
  20. } catch (e) {
  21. err = e;
  22. }
  23. assert.equal(err, 1);
  24. assert.ok(!fixture.hasMessage('Template missing does not exist!'));
  25. });
  26. it('starlight', async () => {
  27. const context = { template: 'starlight', exit };
  28. await verify(context);
  29. assert.equal(fixture.messages().length, 0, 'Did not expect `verify` to log any messages');
  30. });
  31. it('starlight/tailwind', async () => {
  32. const context = { template: 'starlight/tailwind', exit };
  33. await verify(context);
  34. assert.equal(fixture.messages().length, 0, 'Did not expect `verify` to log any messages');
  35. });
  36. });