Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae0aa60

Browse files
committed
[FIX] test: eslint warnings
1 parent 1d68754 commit ae0aa60

File tree

2 files changed

+48
-50
lines changed

2 files changed

+48
-50
lines changed

test/config-parser.spec.js

Lines changed: 47 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,155 @@
11
#!/usr/bin/env node
2+
23
var mockConfig = require('./mock.config.json'),
34
configParser = require('../lib/config-parser')(mockConfig),
45
defaultConf = require('../lib/configs/turbo.json'),
56
shell = require('shelljs'),
67
helpers = require('./helpers'),
78
res;
89

9-
describe('config_parse.js', function () {
10+
describe('config_parse.js', function() {
1011
'use strict';
1112

12-
beforeEach(function () {
13+
beforeEach(function() {
1314
configParser = require('./../lib/config-parser')(mockConfig);
1415
});
1516

16-
describe('should have defined:', function () {
17-
it('getTagsFormat', function () {
17+
describe('should have defined:', function() {
18+
it('getTagsFormat', function() {
1819
expect(configParser.getTagsFormat);
1920
});
20-
it('getCommitConf', function () {
21+
it('getCommitConf', function() {
2122
expect(configParser.getCommitConf);
2223
});
23-
it('getProperty', function () {
24+
it('getProperty', function() {
2425
expect(configParser.getProperty);
2526
});
26-
it('getLogCommand', function () {
27+
it('getLogCommand', function() {
2728
expect(configParser.getLogCommand);
2829
});
29-
it('getCommitPromptTex', function () {
30+
it('getCommitPromptTex', function() {
3031
expect(configParser.getCommitPromptText);
3132
});
32-
it('getConfigFilesData', function () {
33+
it('getConfigFilesData', function() {
3334
expect(configParser.getConfigFilesData);
3435
});
3536
});
36-
describe('getTagsFormat:', function () {
37-
it('should return an array with elements', function () {
37+
describe('getTagsFormat:', function() {
38+
it('should return an array with elements', function() {
3839
expect(configParser.getTagsFormat().length).toBeGreaterThan(0);
3940
});
4041
});
41-
describe('getCommitConf:', function () {
42-
it('should return results', function () {
42+
describe('getCommitConf:', function() {
43+
it('should return results', function() {
4344
expect(configParser.getCommitConf().length).toBeGreaterThan(0);
4445
});
4546
});
4647

47-
describe('getLogCommand:', function () {
48-
it('should return a string with a command', function () {
48+
describe('getLogCommand:', function() {
49+
it('should return a string with a command', function() {
4950
expect(typeof configParser.getLogCommand()).toBe('string');
5051
});
5152
});
5253

53-
describe('getCommitPromptText:', function () {
54-
it('should return false without params', function () {
54+
describe('getCommitPromptText:', function() {
55+
it('should return false without params', function() {
5556
expect(configParser.getCommitPromptText()).toBeFalsy();
5657
});
57-
it('should return false with an unknown prop parameter', function () {
58+
it('should return false with an unknown prop parameter', function() {
5859
expect(configParser.getCommitPromptText('prop212321')).toBeFalsy();
5960
});
60-
it('should return false if the prop is set on "" in the conf', function () {
61+
it('should return false if the prop is set on "" in the conf', function() {
6162
mockConfig.turboCommit.textAskDesc = '';
6263
configParser = require('./../lib/config-parser')(mockConfig);
6364
expect(configParser.getCommitPromptText('desc')).toBeFalsy();
6465
});
65-
it('should return false if the prop is set on false in the conf', function () {
66+
it('should return false if the prop is set on false in the conf', function() {
6667
mockConfig.turboCommit.textAskDesc = false;
6768
configParser = require('./../lib/config-parser')(mockConfig);
6869
expect(configParser.getCommitPromptText('desc')).toBeFalsy();
6970
});
70-
it('should return false if the prop is set on 0 in the conf', function () {
71+
it('should return false if the prop is set on 0 in the conf', function() {
7172
mockConfig.turboCommit.textAskDesc = 0;
7273
configParser = require('./../lib/config-parser')(mockConfig);
7374
expect(configParser.getCommitPromptText('desc')).toBeFalsy();
7475
});
75-
it('should retun the string with the right value', function () {
76+
it('should retun the string with the right value', function() {
7677
mockConfig.turboCommit.textAskDesc = 'description here';
7778
configParser = require('./../lib/config-parser')(mockConfig);
7879
expect(configParser.getCommitPromptText('desc')).toBe('description here');
7980
});
8081
});
8182

82-
describe('getProperty:', function () {
83-
beforeEach(function () {
84-
spyOn(helpers.mockProcess,'exit');
83+
describe('getProperty:', function() {
84+
beforeEach(function() {
85+
spyOn(helpers.mockProcess, 'exit');
8586
configParser = require('./../lib/config-parser')(mockConfig, helpers.mockProcess);
8687
});
8788

88-
it('should return results with right param', function () {
89+
it('should return results with right param', function() {
8990
expect(typeof configParser.getProperty('commitConvention')).toBe('object');
9091
});
91-
it('should call process.exit(1) without params', function () {
92+
it('should call process.exit(1) without params', function() {
9293
configParser.getProperty();
9394
expect(helpers.mockProcess.exit).toHaveBeenCalledWith(1);
9495
});
95-
it('should call process.exit(1) with an unknown property', function () {
96+
it('should call process.exit(1) with an unknown property', function() {
9697
configParser.getProperty('hola-test');
9798
expect(helpers.mockProcess.exit).toHaveBeenCalledWith(1);
9899
});
99-
it('should return result with a property that It has boolean value', function () {
100+
it('should return result with a property that It has boolean value', function() {
100101
expect(configParser.getProperty('debug')).toBe(false);
101102
});
102103
});
103104

104-
describe('init:', function () {
105-
it('should read the default conf without .turbogit', function () {
105+
describe('init:', function() {
106+
it('should read the default conf without .turbogit', function() {
106107
configParser = require('./../lib/config-parser')();
107108
expect(configParser.getProperty('commitConvention')).toEqual(defaultConf.commitConvention);
108109
});
109110

110-
it('should read the config for the .turbogit file if exists', function () {
111+
it('should read the config for the .turbogit file if exists', function() {
111112
helpers.gitInitInTempFolder();
112113
shell.cat('../test/mock.config.json').to('.turbogit');
113114
configParser = require('./../lib/config-parser')();
114115
expect(configParser.getCommitConf()).toEqual(mockConfig.commitConvention.commitDesc);
115116
helpers.finishTemp();
116117
});
117118
});
118-
describe('getConfigFileData:', function () {
119-
120-
beforeEach(function (){
119+
describe('getConfigFileData:', function() {
120+
beforeEach(function() {
121121
res = configParser.getConfigFilesData();
122-
})
122+
});
123123

124-
it('should return an array', function () {
124+
it('should return an array', function() {
125125
expect(res instanceof Array).toBeTruthy();
126126
});
127127

128-
it('should return an array of objects', function () {
128+
it('should return an array of objects', function() {
129129
expect(res[0] instanceof Object).toBeTruthy();
130130
});
131131

132-
it('should return an array of objects with name prop', function () {
132+
it('should return an array of objects with name prop', function() {
133133
expect(res[0].name).toBeDefined();
134134
});
135-
it('should return an array of objects with value prop', function () {
135+
it('should return an array of objects with value prop', function() {
136136
expect(res[0].value).toBeDefined();
137137
});
138-
it('should return an array of objects with getter prop', function () {
138+
it('should return an array of objects with getter prop', function() {
139139
expect(res[0].getter).toBeDefined();
140140
});
141141

142-
describe('getter props on objects returned:', function () {
143-
it('should be a function', function () {
144-
res.forEach( function (obj) {
142+
describe('getter props on objects returned:', function() {
143+
it('should be a function', function() {
144+
res.forEach(function(obj) {
145145
expect(obj.getter instanceof Function).toBeTruthy();
146146
});
147147
});
148-
it('should return a json on call', function () {
149-
res.forEach( function (obj) {
148+
it('should return a json on call', function() {
149+
res.forEach(function(obj) {
150150
expect(obj.getter() instanceof Object).toBeTruthy();
151151
});
152152
});
153-
})
153+
});
154154
});
155-
156155
});

test/utils.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ describe('utils.js', function () {
110110
});
111111
});
112112
describe('checkLocalConfigFile', function () {
113-
114113
it('should call shell test', function () {
115114
spyOn(shell,'test');
116115
utils.checkLocalConfigFile();
@@ -125,7 +124,7 @@ describe('utils.js', function () {
125124

126125
it('should return a path with a .turbogit file', function () {
127126
helpers.gitInitInTempFolder();
128-
shell.touch('.turbogit')
127+
shell.touch('.turbogit');
129128
expect( typeof utils.checkLocalConfigFile()).toBe('string');
130129
helpers.finishTemp();
131130
});

0 commit comments

Comments
 (0)