File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 55 parseYAMLIntoMetadata ,
66 transformTypeToReferenceLink ,
77 parseHeadingIntoMetadata ,
8+ normalizeYamlSyntax ,
89} from '../parser/index.mjs' ;
910
1011describe ( 'transformTypeToReferenceLink' , ( ) => {
@@ -23,6 +24,35 @@ describe('transformTypeToReferenceLink', () => {
2324 } ) ;
2425} ) ;
2526
27+ describe ( 'normalizeYamlSyntax' , ( ) => {
28+ it ( 'should normalize YAML syntax by fixing noncompliant properties' , ( ) => {
29+ const input = `introduced_in=v0.1.21
30+ source_link=lib/test.js
31+ type=module
32+ name=test_module
33+ llm_description=This is a test module` ;
34+
35+ const normalizedYaml = normalizeYamlSyntax ( input ) ;
36+
37+ strictEqual (
38+ normalizedYaml ,
39+ `introduced_in: v0.1.21
40+ source_link: lib/test.js
41+ type: module
42+ name: test_module
43+ llm_description: This is a test module`
44+ ) ;
45+ } ) ;
46+
47+ it ( 'should remove leading and trailing newlines' , ( ) => {
48+ const input = '\nintroduced_in=v0.1.21\n' ;
49+
50+ const normalizedYaml = normalizeYamlSyntax ( input ) ;
51+
52+ strictEqual ( normalizedYaml , 'introduced_in: v0.1.21' ) ;
53+ } ) ;
54+ } ) ;
55+
2656describe ( 'parseYAMLIntoMetadata' , ( ) => {
2757 it ( 'should parse a YAML string into a JavaScript object' , ( ) => {
2858 const input = 'name: test\ntype: module\nintroduced_in: v1.0.0' ;
You can’t perform that action at this time.
0 commit comments