Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Commit ef6d315

Browse files
committed
fix coding style in tests
1 parent 2dce5f8 commit ef6d315

File tree

7 files changed

+47
-46
lines changed

7 files changed

+47
-46
lines changed

template/bam.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ module.exports = {
2323
deploy: function(options) {
2424
console.log(options.env);
2525
console.log(options.doge);
26-
}
26+
},
2727
};

test/bam-cmd.spec.js

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* global describe, it */
2+
13
var chai = require('chai');
24
var sinon = require('sinon');
35
var expect = chai.expect;
@@ -73,7 +75,7 @@ describe('bam-cmd main module', function() {
7375
sinon.stub(childProcess, 'spawn');
7476

7577
var eventManager = {
76-
on: function(event, cb) {return cb(0);}
78+
on: function(event, cb) {return cb(0);},
7779
};
7880

7981
childProcess.spawn.returns(eventManager);
@@ -82,9 +84,6 @@ describe('bam-cmd main module', function() {
8284
var args = ['args'];
8385
var options = {cwd: '..'};
8486

85-
var success = sinon.spy();
86-
var error = sinon.spy();
87-
8887
bamCmd.spawn(cmd, args, options);
8988
expect(childProcess.spawn.called).to.be.true;
9089

@@ -102,7 +101,7 @@ describe('bam-cmd main module', function() {
102101

103102
var errorCode = 0;
104103
var eventManager = {
105-
on: function(event, cb) {return cb(errorCode);}
104+
on: function(event, cb) {return cb(errorCode);},
106105
};
107106

108107
childProcess.spawn.returns(eventManager);
@@ -132,7 +131,7 @@ describe('bam-cmd main module', function() {
132131

133132
var errorCode = 0;
134133
var eventManager = {
135-
on: function(event, cb) {return cb(errorCode);}
134+
on: function(event, cb) {return cb(errorCode);},
136135
};
137136

138137
childProcess.spawn.returns(eventManager);
@@ -163,14 +162,14 @@ describe('bam-cmd main module', function() {
163162
sinon.stub(bamCmd, 'run');
164163

165164
bamCmd.run.returns(Promise.resolve());
166-
repo = repos[0];
165+
var repo = repos[0];
167166

168-
var promise = bamCmd.cloneRepository(repo.givenParam, 'dir', 'parent');
167+
bamCmd.cloneRepository(repo.givenParam, 'dir', 'parent');
169168

170169
var runCallArgs = bamCmd.run.getCall(0).args;
171170
expect(runCallArgs[0]).to.be.equals('git');
172171
expect(runCallArgs[1]).to.have.members([
173-
'clone', '--recursive', repo.repoFullName, path.resolve('parent', 'dir')
172+
'clone', '--recursive', repo.repoFullName, path.resolve('parent', 'dir'),
174173
]);
175174

176175
bamCmd.run.restore();
@@ -180,14 +179,14 @@ describe('bam-cmd main module', function() {
180179
sinon.stub(bamCmd, 'run');
181180

182181
bamCmd.run.returns(Promise.resolve());
183-
repo = repos[0];
182+
var repo = repos[0];
184183

185-
var promise = bamCmd.cloneRepository(repo.givenParam);
184+
bamCmd.cloneRepository(repo.givenParam);
186185

187186
var runCallArgs = bamCmd.run.getCall(0).args;
188187
expect(runCallArgs[0]).to.be.equals('git');
189188
expect(runCallArgs[1]).to.have.members([
190-
'clone', '--recursive', repo.repoFullName, path.resolve('.', repo.repoName)
189+
'clone', '--recursive', repo.repoFullName, path.resolve('.', repo.repoName),
191190
]);
192191

193192
bamCmd.run.restore();
@@ -198,7 +197,7 @@ describe('bam-cmd main module', function() {
198197
it('should rename a project directory', function() {
199198
sinon.stub(fs, 'renameSync');
200199

201-
var expectedFinalDir = "finalDir"
200+
var expectedFinalDir = 'finalDir';
202201
var option = {getDirName: function() {
203202
return expectedFinalDir;
204203
}};
@@ -220,7 +219,7 @@ describe('bam-cmd main module', function() {
220219
sinon.stub(fs, 'renameSync');
221220
sinon.stub(bamCmd, 'loadFromDir');
222221

223-
var expectedFinalDir = "finalDir";
222+
var expectedFinalDir = 'finalDir';
224223
var option = {getDirName: function() {
225224
return expectedFinalDir;
226225
}};
@@ -244,7 +243,7 @@ describe('bam-cmd main module', function() {
244243
it('should handle absolute path when rename a project directory', function() {
245244
sinon.stub(fs, 'renameSync');
246245

247-
var expectedFinalDir = "finalDir"
246+
var expectedFinalDir = 'finalDir';
248247
var option = {getDirName: function() {
249248
return expectedFinalDir;
250249
}};
@@ -345,7 +344,7 @@ describe('bam-cmd main module', function() {
345344
sinon.stub(fs, 'statSync');
346345
sinon.stub(bamCmd, 'spawn');
347346

348-
spawnReturn = {then: function(){}};
347+
var spawnReturn = {then: function(){}};
349348
bamCmd.spawn.returns(spawnReturn);
350349

351350
var promise = bamCmd.installNodeDependencies('directory');
@@ -471,10 +470,10 @@ describe('bam-cmd main module', function() {
471470
sinon.stub(bamCmd, 'runInstall');
472471

473472
var config = {
474-
runPostInstall: sinon.spy()
473+
runPostInstall: sinon.spy(),
475474
};
476475
var linkedConfig = {
477-
runPostInstall: sinon.spy()
476+
runPostInstall: sinon.spy(),
478477
};
479478
var options = {};
480479

@@ -513,10 +512,10 @@ describe('bam-cmd main module', function() {
513512
bamCmd.renameProjectDir.returns(Promise.resolve());
514513
bamCmd.runInstall.returns(Promise.resolve());
515514
var options = {
516-
installLinked: false
515+
installLinked: false,
517516
};
518517
var config = {
519-
runPostInstall: sinon.spy()
518+
runPostInstall: sinon.spy(),
520519
};
521520

522521
return bamCmd.setupProject('.', config, options).then(function() {

test/commands.spec.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* global describe, it, before, after */
2+
13
var chai = require('chai');
24
var sinon = require('sinon');
35
var expect = chai.expect;
@@ -47,7 +49,7 @@ describe('commands', function() {
4749

4850
var command = new Command({});
4951
return command.loadConfig()
50-
.then(function(config) {
52+
.then(function() {
5153
expect(bamCmd.loadConfig.called).to.be.true;
5254
expect(bamCmd.loadConfig.getCall(0).args.length).to.be.equal(0);
5355
bamCmd.loadConfig.restore();
@@ -152,21 +154,21 @@ describe('commands', function() {
152154

153155
it('should catch build errors', function() {
154156
var command = new Command({}, [], {
155-
build: function() {return Promise.reject()},
157+
build: function() {return Promise.reject();},
156158
});
157159
return command.build();
158160
});
159161

160162
it('should catch deploy errors', function() {
161163
var command = new Command({}, [], {
162-
deploy: function() {return Promise.reject()},
164+
deploy: function() {return Promise.reject();},
163165
});
164166
return command.deploy();
165167
});
166168

167169
it('should catch install errors', function() {
168170
var command = new Command({}, [], {
169-
install: function() {return Promise.reject()},
171+
install: function() {return Promise.reject();},
170172
});
171173
return command.install();
172174
});

test/config.spec.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* global describe, it */
2+
13
var chai = require('chai');
24
var sinon = require('sinon');
35
var expect = chai.expect;
@@ -96,14 +98,14 @@ describe('Config Entity', function() {
9698

9799
it('should throw if not loaded when get the dir name', function() {
98100
var config = new Config();
99-
expect(function(){config.getDirName()}).to.throw(Error);
101+
expect(function(){config.getDirName();}).to.throw(Error);
100102
});
101103

102104
it('should get linked repositories', function() {
103105
var repos = ['repo1', 'rep2', 'r3'];
104106

105107
var config = new Config({
106-
linkedRepos: repos
108+
linkedRepos: repos,
107109
});
108110
return config.load().then(function() {
109111
expect(config.getLinkedRepos()).to.be.equals(repos);
@@ -120,7 +122,7 @@ describe('Config Entity', function() {
120122

121123
it('should throw if not loaded when get the dir name', function() {
122124
var config = new Config();
123-
expect(function(){config.getLinkedRepos()}).to.throw(Error);
125+
expect(function(){config.getLinkedRepos();}).to.throw(Error);
124126
});
125127

126128

test/fixtures/bam-default.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@ var config = {
22
scriptVersion: '0.0.23456789',
33
dirName: 'default-fixture-config',
44
linkedRepos: [],
5-
install: function() {
6-
},
7-
buildOptions: function(commander) {
8-
},
9-
build: function(options) {
10-
},
11-
deploy: function(options) {
12-
}
5+
install: function() {},
6+
buildOptions: function() {},
7+
build: function() {},
8+
deploy: function() {},
139
};
1410

1511
module.exports = config;

test/fixtures/repositories.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,46 @@ module.exports = [
22
{
33
givenParam: 'ssh://[email protected]:8080/path/to/repo.git',
44
repoFullName: 'ssh://[email protected]:8080/path/to/repo.git',
5-
repoName: 'repo'
5+
repoName: 'repo',
66
},
77
{
88
givenParam: 'ssh://host.xz/path/repo.git',
99
repoFullName: 'ssh://host.xz/path/repo.git',
10-
repoName: 'repo'
10+
repoName: 'repo',
1111
},
1212
{
1313
givenParam: 'git://host.xz:1234/path/to/repo.git/',
1414
repoFullName: 'git://host.xz:1234/path/to/repo.git/',
15-
repoName: 'repo'
15+
repoName: 'repo',
1616
},
1717
{
1818
givenParam: 'host.xz:path/to/repo',
1919
repoFullName: 'host.xz:path/to/repo',
20-
repoName: 'repo'
20+
repoName: 'repo',
2121
},
2222
{
2323
givenParam: '[email protected]:path/to/repo/',
2424
repoFullName: '[email protected]:path/to/repo/',
25-
repoName: 'repo'
25+
repoName: 'repo',
2626
},
2727
{
2828
givenParam: 'tj/commander.js.git',
2929
repoFullName: '[email protected]:tj/commander.js.git',
30-
repoName: 'commander.js'
30+
repoName: 'commander.js',
3131
},
3232
{
3333
givenParam: 'commander.js.git',
3434
repoFullName: '[email protected]:orga/commander.js.git',
35-
repoName: 'commander.js'
35+
repoName: 'commander.js',
3636
},
3737
{
3838
givenParam: 'commander.js',
3939
repoFullName: '[email protected]:orga/commander.js.git',
40-
repoName: 'commander.js'
40+
repoName: 'commander.js',
4141
},
4242
{
4343
givenParam: 'repoWithMaj',
4444
repoFullName: '[email protected]:orga/repoWithMaj.git',
45-
repoName: 'repoWithMaj'
45+
repoName: 'repoWithMaj',
4646
},
4747
];

test/plugins.spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* global describe, it, beforeEach */
2+
13
var chai = require('chai');
24
var sinon = require('sinon');
35
var expect = chai.expect;
@@ -29,7 +31,7 @@ describe('plugins', function() {
2931
bamjs = {
3032
plugins: [plugin1, plugin2],
3133
install: sinon.spy(),
32-
postInstall: sinon.spy()
34+
postInstall: sinon.spy(),
3335
};
3436

3537
config = new Config(bamjs);

0 commit comments

Comments
 (0)