Skip to content

Commit ed84e1c

Browse files
depimomoMonica Kristiadi
andauthored
test(util): add test for parseApiDocsVersion in util (nodejs#2857)
Co-authored-by: Monica Kristiadi <[email protected]>
1 parent 001f896 commit ed84e1c

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { parseApiDocsVersion } from '../parseApiDocsVersion';
2+
3+
describe('parseApiDocsVersion', (): void => {
4+
it('should be defined', (): void => {
5+
expect(parseApiDocsVersion).toBeDefined();
6+
});
7+
8+
it(`should return the version when passing string`, (): void => {
9+
const stringVersion = '1.0';
10+
expect(parseApiDocsVersion(stringVersion)).toEqual(stringVersion);
11+
});
12+
13+
it(`should return joined version with comma when passing array`, (): void => {
14+
const arrayVersion = ['1.0', '1.1', '2.4'];
15+
const expectedJoinedArray = '1.0, 1.1, 2.4';
16+
17+
expect(parseApiDocsVersion(arrayVersion)).toEqual(expectedJoinedArray);
18+
});
19+
});

0 commit comments

Comments
 (0)