Skip to content

Commit

Permalink
Added a test for 100% CC in the "getOptions()" util function.
Browse files Browse the repository at this point in the history
  • Loading branch information
pomek committed Jul 11, 2019
1 parent 21ad587 commit 1e21991
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/utils/getoptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ module.exports = function cwdResolver( callOptions, cwd ) {

options.packages = path.resolve( cwd, options.packages );

/* istanbul ignore if */
if ( !Array.isArray( options.packagesPrefix ) ) {
options.packagesPrefix = [ options.packagesPrefix ];
}
Expand Down
28 changes: 28 additions & 0 deletions tests/utils/getoptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,34 @@ describe( 'utils', () => {
} );
} );

it( 'returns "packagesPrefix" as array', () => {
const options = getOptions( {
packagesPrefix: 'ckeditor5-'
}, cwd );

expect( options ).to.have.property( 'dependencies' );

delete options.dependencies;

expect( options ).to.deep.equal( {
cwd,
packages: path.resolve( cwd, 'packages' ),
resolverPath: path.resolve( __dirname, '../../lib/default-resolver.js' ),
resolverUrlTemplate: 'git@github.com:${ path }.git',
resolverTargetDirectory: 'git',
resolverDefaultBranch: 'master',
scope: null,
ignore: null,
packagesPrefix: [
'ckeditor5-'
],
overrideDirectoryNames: {
'override-directory': 'custom-directory'
},
standardBranches: []
} );
} );

it( 'attaches to options branch name from the cwd directory (if in git repository)', () => {
const fsExistsStub = sinon.stub( fs, 'existsSync' );
const shelljsStub = sinon.stub( shell, 'exec' );
Expand Down

0 comments on commit 1e21991

Please sign in to comment.