license import { assert } from 'chai' ; import exec , { checkCommand } from '../../util/exec' ; suite ( 'src/util/exec' , ( ) => { suite ( 'exec()' , ( ) => { test ( 'returns false if current directory does not exist' , async ( ) => { const testCwd = process . cwd ( ) ; const result = await exec ( testCwd , 'pwd' ) ; assert . deepEqual ( result , { stdout : testCwd , stderr : '' } ) ; } ) ; test ( 'passes arguments correctly' , async ( ) => { const testOutput = 'HELLO THERE' ; const result = await exec ( '' , 'echo' , [ testOutput ] ) ; assert . deepEqual ( result , { stdout : testOutput , stderr : '' } ) ; } ) ; } ) ; suite ( 'checkCommand()' , ( ) => { test ( 'returns true if command exists in shell path' , async ( ) => { assert . isTrue ( await checkCommand ( 'node' ) ) ; } ) ; test ( 'returns false if command does not exist in shell path' , async ( ) => { assert . isFalse ( await checkCommand ( 'there-is-no-way-this-exists-ia23t4niaq23n' ) ) ; } ) ; } ) ; } ) ;