Skip to content

Commit 51066e4

Browse files
committed
Added test.
1 parent e70a5d7 commit 51066e4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

packages/doxdox-core/src/utils.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
getRootDirPath,
1010
isDirectory,
1111
isFile,
12+
multiLinePatternMatch,
1213
parseConfigFromCLI,
1314
parseIgnoreConfig,
1415
slugify
@@ -98,6 +99,36 @@ describe('utils', () => {
9899
});
99100
});
100101

102+
describe('multiLinePatternMatch', () => {
103+
it('find pattern in content', async () => {
104+
expect(
105+
multiLinePatternMatch(
106+
`/**
107+
* Get the current working directory.
108+
*
109+
* @return {string} Directory path.
110+
* @public
111+
*/
112+
113+
function getCurrentWorkingDirectory() {}`,
114+
`/**
115+
* Get the current working directory.
116+
*
117+
* @return {string} Directory path.
118+
* @public
119+
*/`
120+
)
121+
).toEqual(
122+
expect.objectContaining({ matched: true, start: 0, end: 6 })
123+
);
124+
});
125+
it('fail to find pattern', async () => {
126+
expect(multiLinePatternMatch('', '// @ts-ignore')).toEqual(
127+
expect.objectContaining({ matched: false })
128+
);
129+
});
130+
});
131+
101132
describe('parseConfigFromCLI', () => {
102133
it('parse config', () => {
103134
expect(

0 commit comments

Comments
 (0)