Skip to content

Commit 1d66af0

Browse files
authored
Merge pull request #179 from docsbydoxdox/feature/parser-template-tests
[feat] Added parseString method to parser template.
2 parents ba505d2 + 06d593e commit 1d66af0

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { parseString } from './index';
2+
3+
describe('template parser', () => {
4+
it('parse empty string', async () => {
5+
await expect(parseString('test.js', '')).resolves.toEqual(
6+
expect.objectContaining({
7+
path: 'test.js',
8+
methods: []
9+
})
10+
);
11+
});
12+
});
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
import { promises as fs } from 'fs';
2+
3+
import { join } from 'path';
4+
15
import { File } from 'doxdox-core';
26

3-
export default async (cwd: string, path: string): Promise<File> => ({
4-
path,
5-
methods: []
6-
});
7+
export default async (cwd: string, path: string): Promise<File> =>
8+
await parseString(path, await fs.readFile(join(cwd, path), 'utf8'));
9+
10+
export const parseString = async (
11+
path: string,
12+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
13+
content: string
14+
): Promise<File> => {
15+
return { path, methods: [] };
16+
};

0 commit comments

Comments
 (0)