@@ -3,20 +3,31 @@ import { expect } from "chai";
33import fs from "fs" ;
44import yaml from "js-yaml" ;
55
6- import { includeType } from "../../src/utils/yaml" ;
7- import { YAML_INCLUDE_FILE } from "../enums" ;
6+ import { listToStringType } from "../../src/utils/yaml" ;
7+ import { YAML_LIST_TO_STRING_FILE } from "../enums" ;
88
9- const includeSchema = yaml . DEFAULT_SCHEMA . extend ( [ includeType ] ) ;
9+ const includeSchema = yaml . DEFAULT_SCHEMA . extend ( [ listToStringType ] ) ;
1010
11- describe . only ( "YAML tag: !listToString" , ( ) => {
12- const yamlFixture = fs . readFileSync ( YAML_INCLUDE_FILE , "utf8" ) ;
11+ describe ( "YAML tag: !listToString" , ( ) => {
12+ const yamlFixture = fs . readFileSync ( YAML_LIST_TO_STRING_FILE , "utf8" ) ;
1313
1414 it ( "should correctly concatenate content from list to string" , ( ) => {
1515 const parsed = yaml . load ( yamlFixture , { schema : includeSchema } ) ;
16+
1617 const expected = {
1718 here : "original content" ,
18- there : [ "run" , "stop" , "pause" ] ,
19+ there : "onetwo" ,
1920 } ;
2021 expect ( parsed . case1 ) . to . be . eql ( expected ) ;
2122 } ) ;
23+
24+ it ( "should correctly filter out and concatenate only strings from list" , ( ) => {
25+ const parsed = yaml . load ( yamlFixture , { schema : includeSchema } ) ;
26+
27+ const expected = {
28+ here : "original content" ,
29+ there : "onetwo" ,
30+ } ;
31+ expect ( parsed . case2 ) . to . be . eql ( expected ) ;
32+ } ) ;
2233} ) ;
0 commit comments