@@ -103,5 +103,37 @@ test('Works with stdin', async (t) => {
103103
104104 await waitForStreamClose ( create ) ;
105105
106- assert . ok ( fs . existsSync ( path ) ) ;
106+ assert . deepEqual ( fs . readFileSync ( path , "utf8" ) , SAMPLE_CONTENT ) ;
107+ } ) ;
108+
109+ test ( 'Trim single quotes on stdin' , async ( t ) => {
110+ t . after ( ( ) => {
111+ rimrafSync ( "./test/stubs-stdin-single-quote/" ) ;
112+ } ) ;
113+
114+ let echo = spawn ( 'echo' , [ `'${ SAMPLE_CONTENT } '` ] ) ;
115+ let path = 'test/stubs-stdin-single-quote/index.md' ;
116+ let create = spawn ( "node" , [ '.' , path ] ) ;
117+
118+ echo . stdout . pipe ( create . stdin ) ;
119+
120+ await waitForStreamClose ( create ) ;
121+
122+ assert . deepEqual ( fs . readFileSync ( path , "utf8" ) , SAMPLE_CONTENT ) ;
123+ } ) ;
124+
125+ test ( 'Trim double quotes on stdin' , async ( t ) => {
126+ t . after ( ( ) => {
127+ rimrafSync ( "./test/stubs-stdin-double-quote/" ) ;
128+ } ) ;
129+
130+ let echo = spawn ( 'echo' , [ `"${ SAMPLE_CONTENT } "` ] ) ;
131+ let path = 'test/stubs-stdin-double-quote/index.md' ;
132+ let create = spawn ( "node" , [ '.' , path ] ) ;
133+
134+ echo . stdout . pipe ( create . stdin ) ;
135+
136+ await waitForStreamClose ( create ) ;
137+
138+ assert . deepEqual ( fs . readFileSync ( path , "utf8" ) , SAMPLE_CONTENT ) ;
107139} ) ;
0 commit comments