Skip to content

Commit 5389c14

Browse files
committed
test(gen:endpoint): add jscs endpoint tests
1 parent f145af2 commit 5389c14

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

src/test/endpoint.test.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ function jshintDir(dir, name, folder) {
126126

127127
return Promise.all([regFiles, specFiles]);
128128
}
129+
function jscsDir(dir, name, folder) {
130+
if(!folder) folder = name;
131+
let endpointDir = path.join(dir, 'server/api', folder);
132+
133+
return fs.readdirAsync(endpointDir)
134+
.map(file => testFile(jscsCmd, path.join('./server/api/', folder, file)));;
135+
}
129136

130137
var config;
131138
var genDir;
@@ -154,7 +161,8 @@ describe('angular-fullstack:endpoint', function() {
154161

155162
return Promise.all([
156163
copyAsync(path.join(genDir, '/server/.jshintrc'), './server/.jshintrc'),
157-
copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec')
164+
copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec'),
165+
copyAsync(path.join(genDir, '/.jscsrc'), './.jscsrc')
158166
]);
159167
});
160168
});
@@ -163,7 +171,9 @@ describe('angular-fullstack:endpoint', function() {
163171
assert.file(getExpectedFiles.endpoint('foo'));
164172
});
165173

166-
it('should pass jscs');
174+
it('should pass jscs', function() {
175+
return jscsDir(dir, 'foo').should.be.fulfilled();
176+
});
167177

168178
it('should pass lint', function() {
169179
return jshintDir(dir, 'foo').should.be.fulfilled();
@@ -178,7 +188,8 @@ describe('angular-fullstack:endpoint', function() {
178188

179189
return Promise.all([
180190
copyAsync(path.join(genDir, '/server/.jshintrc'), './server/.jshintrc'),
181-
copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec')
191+
copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec'),
192+
copyAsync(path.join(genDir, '/.jscsrc'), './.jscsrc')
182193
]);
183194
});
184195
});
@@ -187,7 +198,9 @@ describe('angular-fullstack:endpoint', function() {
187198
assert.file(getExpectedFiles.endpoint('Foo'));
188199
});
189200

190-
it('should pass jscs');
201+
it('should pass jscs', function() {
202+
return jscsDir(dir, 'Foo').should.be.fulfilled();
203+
});
191204

192205
it('should pass lint', function() {
193206
return jshintDir(dir, 'Foo').should.be.fulfilled();
@@ -202,7 +215,8 @@ describe('angular-fullstack:endpoint', function() {
202215

203216
return Promise.all([
204217
copyAsync(path.join(genDir, '/server/.jshintrc'), './server/.jshintrc'),
205-
copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec')
218+
copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec'),
219+
copyAsync(path.join(genDir, '/.jscsrc'), './.jscsrc')
206220
]);
207221
});
208222
});
@@ -211,7 +225,9 @@ describe('angular-fullstack:endpoint', function() {
211225
assert.file(getExpectedFiles.endpoint('bar', 'foo/bar'));
212226
});
213227

214-
it('should pass jscs');
228+
it('should pass jscs', function() {
229+
return jscsDir(dir, 'foo', 'foo/bar').should.be.fulfilled();
230+
});
215231

216232
it('should pass lint', function() {
217233
return jshintDir(dir, 'foo', 'foo/bar').should.be.fulfilled();

0 commit comments

Comments
 (0)