'use strict' ; import * as chai from 'chai' ; import * as sinonChai from 'sinon-chai' ; import { FileSystemUtil } from '../../src/util/FileSystemUtil' ; chai . use ( sinonChai ) ; describe ( 'FileSystemUtil' , ( ) => { describe ( 'getDirPath' , ( ) => { beforeEach ( ( ) => { delete process . env . CHE_PROJECTS_ROOT ; } ) ; afterEach ( ( ) => { delete process . env . CHE_PROJECTS_ROOT ; } ) ; it ( 'should replace ~ with the users home directory' , ( ) => { const packageDirOriginal = '~/smartContractDir' ; const packageDirNew = FileSystemUtil . getDirPath ( packageDirOriginal ) ; packageDirNew . should . not . contain ( '~' ) ; } ) ; it ( 'should replace ~ with the users projects directory on Eclipse Che' , ( ) => { process . env . CHE_PROJECTS_ROOT = '/projects' ; const packageDirOriginal = '~/smartContractDir' ; const packageDirNew = FileSystemUtil . getDirPath ( packageDirOriginal ) ; packageDirNew . should . equal ( '/projects/smartContractDir' ) ; } ) ; it ( 'should not replace if not ~' , ( ) => { const packageDirOriginal = '/banana/smartContractDir' ; const packageDirNew = FileSystemUtil . getDirPath ( packageDirOriginal ) ; packageDirNew . should . equal ( packageDirOriginal ) ; } ) ; } ) ; } ) ;