|
|
@@ -24,7 +24,7 @@ describe( 'dev-create-package', () => {
|
|
|
const packageName = 'package-name';
|
|
|
const applicationName = 'Full application name';
|
|
|
const packageVersion = '0.0.1';
|
|
|
- const gitHubUrl = 'ckeditor5/package-name';
|
|
|
+ const gitHubPath = 'ckeditor5/package-name';
|
|
|
const packageDescription = 'Package description.';
|
|
|
|
|
|
beforeEach( () => createSpies() );
|
|
|
@@ -37,12 +37,13 @@ describe( 'dev-create-package', () => {
|
|
|
getPackageName: sinon.stub( inquiries, 'getPackageName' ).returns( new Promise( ( r ) => r( packageName ) ) ),
|
|
|
getApplicationName: sinon.stub( inquiries, 'getApplicationName' ).returns( new Promise( ( r ) => r( applicationName ) ) ),
|
|
|
getPackageVersion: sinon.stub( inquiries, 'getPackageVersion' ).returns( new Promise( ( r ) => r( packageVersion ) ) ),
|
|
|
- getPackageGitHubUrl: sinon.stub( inquiries, 'getPackageGitHubUrl' ).returns( new Promise( ( r ) => r( gitHubUrl ) ) ),
|
|
|
+ getPackageGitHubPath: sinon.stub( inquiries, 'getPackageGitHubPath' ).returns( new Promise( ( r ) => r( gitHubPath ) ) ),
|
|
|
getPackageDescription: sinon.stub( inquiries, 'getPackageDescription' ).returns( new Promise( ( r ) => r( packageDescription ) ) ),
|
|
|
initializeRepository: sinon.stub( git, 'initializeRepository' ),
|
|
|
updateJSONFile: sinon.stub( tools, 'updateJSONFile' ),
|
|
|
copy: sinon.stub( tools, 'copyTemplateFiles' ),
|
|
|
- initialCommit: sinon.stub( git, 'initialCommit' )
|
|
|
+ initialCommit: sinon.stub( git, 'initialCommit' ),
|
|
|
+ addRemote: sinon.stub( git, 'addRemote' )
|
|
|
};
|
|
|
}
|
|
|
|
|
|
@@ -62,10 +63,13 @@ describe( 'dev-create-package', () => {
|
|
|
expect( spies.getPackageName.calledOnce ).to.equal( true );
|
|
|
expect( spies.getApplicationName.calledOnce ).to.equal( true );
|
|
|
expect( spies.getPackageVersion.calledOnce ).to.equal( true );
|
|
|
- expect( spies.getPackageGitHubUrl.calledOnce ).to.equal( true );
|
|
|
+ expect( spies.getPackageGitHubPath.calledOnce ).to.equal( true );
|
|
|
expect( spies.getPackageDescription.calledOnce ).to.equal( true );
|
|
|
expect( spies.initializeRepository.calledOnce ).to.equal( true );
|
|
|
expect( spies.initializeRepository.firstCall.args[ 0 ] ).to.equal( repositoryPath );
|
|
|
+ expect( spies.addRemote.calledOnce ).to.equal( true );
|
|
|
+ expect( spies.addRemote.firstCall.args[ 0 ] ).to.equal( repositoryPath );
|
|
|
+ expect( spies.addRemote.firstCall.args[ 1 ] ).to.equal( gitHubPath );
|
|
|
expect( spies.copy.called ).to.equal( true );
|
|
|
expect( spies.updateJSONFile.calledTwice ).to.equal( true );
|
|
|
expect( spies.updateJSONFile.firstCall.args[ 0 ] ).to.equal( path.join( repositoryPath, 'package.json' ) );
|
|
|
@@ -77,7 +81,7 @@ describe( 'dev-create-package', () => {
|
|
|
updateFn = spies.updateJSONFile.secondCall.args[ 1 ];
|
|
|
json = updateFn( {} );
|
|
|
expect( json.dependencies ).to.be.an( 'object' );
|
|
|
- expect( json.dependencies[ packageName ] ).to.equal( gitHubUrl );
|
|
|
+ expect( json.dependencies[ packageName ] ).to.equal( gitHubPath );
|
|
|
expect( spies.initialCommit.calledOnce ).to.equal( true );
|
|
|
expect( spies.initialCommit.firstCall.args[ 0 ] ).to.equal( packageName );
|
|
|
expect( spies.initialCommit.firstCall.args[ 1 ] ).to.equal( repositoryPath );
|