|
|
@@ -37,6 +37,7 @@ describe( 'dev-install', () => {
|
|
|
spies.checkout = sinon.stub( git, 'checkout' );
|
|
|
spies.getGitUrlFromNpm = sinon.stub( tools, 'getGitUrlFromNpm' );
|
|
|
spies.readPackageName = sinon.stub( tools, 'readPackageName' );
|
|
|
+ spies.npmUninstall = sinon.stub( tools, 'npmUninstall' );
|
|
|
} );
|
|
|
|
|
|
afterEach( () => {
|
|
|
@@ -47,10 +48,11 @@ describe( 'dev-install', () => {
|
|
|
it( 'should use GitHub URL', () => {
|
|
|
spies.isDirectory.onFirstCall().returns( false );
|
|
|
spies.isDirectory.onSecondCall().returns( false );
|
|
|
+ spies.isDirectory.onThirdCall().returns( true );
|
|
|
|
|
|
installTask( ckeditor5Path, workspacePath, repositoryUrl, () => {} );
|
|
|
|
|
|
- sinon.assert.calledTwice( spies.isDirectory );
|
|
|
+ sinon.assert.calledThrice( spies.isDirectory );
|
|
|
sinon.assert.calledOnce( spies.parseUrl );
|
|
|
sinon.assert.calledWithExactly( spies.parseUrl, repositoryUrl );
|
|
|
|
|
|
@@ -63,8 +65,14 @@ describe( 'dev-install', () => {
|
|
|
sinon.assert.calledOnce( spies.checkout );
|
|
|
sinon.assert.calledWithExactly( spies.checkout, repositoryPath, urlInfo.branch );
|
|
|
|
|
|
+ sinon.assert.calledOnce( spies.npmInstall );
|
|
|
+ sinon.assert.calledWithExactly( spies.npmInstall, repositoryPath );
|
|
|
+
|
|
|
const linkPath = path.join( ckeditor5Path, 'node_modules', urlInfo.name );
|
|
|
|
|
|
+ sinon.assert.calledOnce( spies.npmUninstall );
|
|
|
+ sinon.assert.calledWithExactly( spies.npmUninstall, ckeditor5Path, urlInfo.name );
|
|
|
+
|
|
|
sinon.assert.calledOnce( spies.linkDirectories );
|
|
|
sinon.assert.calledWithExactly( spies.linkDirectories, repositoryPath, linkPath );
|
|
|
|
|
|
@@ -76,9 +84,6 @@ describe( 'dev-install', () => {
|
|
|
const json = updateFn( {} );
|
|
|
expect( json.dependencies ).to.be.a( 'object' );
|
|
|
expect( json.dependencies[ urlInfo.name ] ).to.equal( repositoryUrl );
|
|
|
-
|
|
|
- sinon.assert.calledOnce( spies.npmInstall );
|
|
|
- sinon.assert.calledWithExactly( spies.npmInstall, ckeditor5Path );
|
|
|
} );
|
|
|
|
|
|
it( 'should use npm module name', () => {
|
|
|
@@ -88,7 +93,7 @@ describe( 'dev-install', () => {
|
|
|
|
|
|
installTask( ckeditor5Path, workspacePath, moduleName, () => {} );
|
|
|
|
|
|
- sinon.assert.calledTwice( spies.isDirectory );
|
|
|
+ sinon.assert.calledThrice( spies.isDirectory );
|
|
|
sinon.assert.calledTwice( spies.parseUrl );
|
|
|
sinon.assert.calledWithExactly( spies.parseUrl.firstCall, moduleName );
|
|
|
expect( spies.parseUrl.firstCall.returnValue ).to.equal( null );
|
|
|
@@ -103,6 +108,9 @@ describe( 'dev-install', () => {
|
|
|
sinon.assert.calledOnce( spies.checkout );
|
|
|
sinon.assert.calledWithExactly( spies.checkout, repositoryPath, urlInfo.branch );
|
|
|
|
|
|
+ sinon.assert.calledOnce( spies.npmInstall );
|
|
|
+ sinon.assert.calledWithExactly( spies.npmInstall, repositoryPath );
|
|
|
+
|
|
|
const linkPath = path.join( ckeditor5Path, 'node_modules', urlInfo.name );
|
|
|
|
|
|
sinon.assert.calledOnce( spies.linkDirectories );
|
|
|
@@ -116,9 +124,6 @@ describe( 'dev-install', () => {
|
|
|
const json = updateFn( {} );
|
|
|
expect( json.dependencies ).to.be.a( 'object' );
|
|
|
expect( json.dependencies[ urlInfo.name ] ).to.equal( repositoryUrl );
|
|
|
-
|
|
|
- sinon.assert.calledOnce( spies.npmInstall );
|
|
|
- sinon.assert.calledWithExactly( spies.npmInstall, ckeditor5Path );
|
|
|
} );
|
|
|
|
|
|
it( 'should use local relative path', () => {
|
|
|
@@ -128,7 +133,7 @@ describe( 'dev-install', () => {
|
|
|
|
|
|
installTask( ckeditor5Path, workspacePath, '../ckeditor5-core', () => {} );
|
|
|
|
|
|
- sinon.assert.calledTwice( spies.isDirectory );
|
|
|
+ sinon.assert.calledThrice( spies.isDirectory );
|
|
|
sinon.assert.calledOnce( spies.readPackageName );
|
|
|
} );
|
|
|
|
|
|
@@ -139,7 +144,7 @@ describe( 'dev-install', () => {
|
|
|
|
|
|
installTask( ckeditor5Path, workspacePath, '/ckeditor5-core', () => {} );
|
|
|
|
|
|
- sinon.assert.calledTwice( spies.isDirectory );
|
|
|
+ sinon.assert.calledThrice( spies.isDirectory );
|
|
|
sinon.assert.calledOnce( spies.readPackageName );
|
|
|
} );
|
|
|
|