test: add initial testing and linting (#18)

This commit is contained in:
Morten Olsen
2025-05-19 21:04:32 +02:00
committed by GitHub
parent 9d04cf0414
commit c01dce4998
33 changed files with 4159 additions and 299 deletions

23
tests/execute.test.ts Normal file
View File

@@ -0,0 +1,23 @@
import { resolve } from 'path';
import { describe, it, expect, beforeAll, afterEach, afterAll } from 'vitest';
import { Context, execute } from '../src/exports.js';
import { server } from './mocks/node.js';
describe('execute', () => {
beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());
it('should correctly render the readme file', async () => {
const context = new Context();
const filePath = resolve(__dirname, '..', 'docs', 'README.md');
const result = await execute(filePath, {
context,
});
expect(result.markdown).toMatchSnapshot();
}, 30000);
});