import 'mocha' ; import { expect } from 'chai' ; import { ShellBuilder } from '@/application/Context/State/Code/Generation/Languages/ShellBuilder' ; describe ( 'ShellBuilder' , ( ) => { class ShellBuilderRevealer extends ShellBuilder { public getCommentDelimiter ( ) { return super . getCommentDelimiter ( ) ; } public writeStandardOut ( text ) { return super . writeStandardOut ( text ) ; } } describe ( 'getCommentDelimiter' , ( ) => { it ( 'returns expected' , ( ) => { const expected = '#' ; const sut = new ShellBuilderRevealer ( ) ; const actual = sut . getCommentDelimiter ( ) ; expect ( expected ) . to . equal ( actual ) ; } ) ; } ) ; describe ( 'writeStandardOut' , ( ) => { const testData = [ { name : 'plain text' , text : 'test' , expected : 'echo \'test\'' , } , { name : 'text with single quote' , text : 'I\'m not who you think I am' , expected : 'echo \'I\'\\\'\'m not who you think I am\'' , } , { name : 'text with multiple single quotes' , text : 'I\'m what you\'re' , expected : 'echo \'I\'\\\'\'m what you\'\\\'\'re\'' , } , ] ; for ( const test of testData ) { it ( test . name , ( ) => { const sut = new ShellBuilderRevealer ( ) ; const actual = sut . writeStandardOut ( test . text ) ; expect ( test . expected ) . to . equal ( actual ) ; } ) ; } } ) ; } ) ;