feat(documentation-directory): add typed markdown directory ingestion with author normalization and test coverage
This commit is contained in:
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: Fixture Article
|
||||
author:
|
||||
firstName: Jane
|
||||
surName: Doe
|
||||
birthday:
|
||||
day: 1
|
||||
month: 1
|
||||
year: 1990
|
||||
articles: []
|
||||
---
|
||||
|
||||
# Fixture Article
|
||||
|
||||
This fixture verifies that smartdocumentation turns markdown files into typed articles.
|
||||
@@ -0,0 +1,16 @@
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
import * as smartdocumentation from '../ts/index.js';
|
||||
|
||||
tap.test('should read markdown files from a documentation directory', async () => {
|
||||
const documentationDirectory = new smartdocumentation.DocumentationDirectory({
|
||||
pathArg: './test/fixtures/docs',
|
||||
});
|
||||
await documentationDirectory.readDirectory();
|
||||
|
||||
expect(documentationDirectory.articles.length).toEqual(1);
|
||||
expect(documentationDirectory.articles[0].title).toEqual('Fixture Article');
|
||||
expect(documentationDirectory.articles[0].author.firstName).toEqual('Jane');
|
||||
expect(documentationDirectory.articles[0].tags[0]).toEqual('path:article.md');
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
@@ -1,8 +0,0 @@
|
||||
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
|
||||
import * as smartdocumentation from '../ts/index.js';
|
||||
|
||||
tap.test('first test', async () => {
|
||||
console.log(smartdocumentation);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
Reference in New Issue
Block a user