Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 909f48c

Browse files
committedJul 13, 2014
Merge pull request #1 from stowns/develop
Develop
2 parents 4096a22 + f1c4de1 commit 909f48c

19 files changed

+147
-95
lines changed
 

‎.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.10.26

‎Gruntfile.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module.exports = function(grunt) {
2+
grunt.initConfig({
3+
pkg: grunt.file.readJSON('package.json'),
4+
5+
jshint: {
6+
dev: {
7+
options: {
8+
jshintrc: true
9+
},
10+
src: ['*.js', 'app/**/*.js', 'lib/**/*.js', 'test/**/*.js', 'models/**/*.js'],
11+
},
12+
},
13+
watch: {
14+
grunt: { files: ['Gruntfile.js'] },
15+
options: {
16+
livereload: true
17+
},
18+
files: ['*.js', 'app/**/*.js', 'lib/**/*.js', 'test/**/*.js', 'models/**/*.js'],
19+
tasks: ['jshint:dev']
20+
},
21+
apidoc: {
22+
apiStarter: {
23+
src: "app/",
24+
dest: "docs/",
25+
options : {
26+
includeFilters: [ ".*\\.js$" ],
27+
excludeFilters: [ "node_modules/" ]
28+
}
29+
}
30+
}
31+
32+
});
33+
34+
35+
grunt.loadNpmTasks('grunt-contrib-jshint');
36+
grunt.loadNpmTasks('grunt-contrib-watch');
37+
grunt.loadNpmTasks('grunt-apidoc');
38+
39+
grunt.registerTask('default', ['apidoc', 'jshint:dev']);
40+
};

‎README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ A seed project for building out a new api. Supports resource-based routing, Seq
77
* [Dependencies](#dependencies)
88
* [Signals](#signals)
99
* [Migrations](#migrations)
10+
* [Docs](#docs)
1011

1112

1213
## Getting Started
13-
- nvm install 0.10.22
14-
- npm install -g mocha
14+
- nvm install 0.10.26
15+
- npm install -g mocha grunt-cli
1516
- npm install
1617
- edit /conf/development.js && /conf/test.js database information appropriately
1718
- createdb api_dev ; createdb api_test
1819
- nvm use
1920
- npm test
2021
- npm start
22+
- optionally, run 'grunt watch' for [JSHint][jshint] results on saves
2123

2224
### Dependencies
2325
- [Node.js ≥ 0.10.22][node]
@@ -46,9 +48,13 @@ Api Starter uses [Sequelize's][sequelize] built in migration support. [Docs her
4648

4749
**IMPORTANT** do *NOT* use the global sequelize binary ie) `sequelize -m`. Use the binary installed locally to the node_modules folder.
4850

51+
### Docs
52+
The default grunt task generates documentation using [APIDoc][apidoc].
4953

5054
[node]: http://nodejs.org/ "Node.js"
5155
[cluster]: http://nodejs.org/docs/v0.10.22/api/cluster.html "Cluster - Node v0.10.22"
5256
[redis]: http://redis.io/download "Redis"
5357
[postgres]: http://www.postgresql.org/ "Postgres"
54-
[sequelize]: http://http://sequelizejs.com/ "Sequelize"
58+
[sequelize]: http://http://sequelizejs.com/ "Sequelize"
59+
[jshint]: http://www.jshint.com/docs/ "JSHint"
60+
[apidoc]: http://apidocjs.com/ "APIDocJS"

‎app/v1/controllers/users/index.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,27 @@ var ResourceController = require(app.locals.appPath + '/lib/sequelizeResourceCon
1111
/* beforeAction definitions */
1212
var before = {
1313
logParams : function(req, res, next) {
14-
log.info('PARAMS:');
15-
log.info(req.params);
14+
if (process.env.NODE_ENV !== 'test') {
15+
log.info('PARAMS:');
16+
log.info(req.params);
17+
}
18+
19+
next();
20+
},
21+
exampleMiddleware : function(req, res, next) {
22+
if (process.env.NODE_ENV !== 'test') {
23+
log.info('example middleware!');
24+
}
1625

1726
next();
1827
}
1928
};
2029

2130
opts = {
2231
before: { // Middleware support
23-
//all: before.logParams,
24-
index: [middleware.authRole('admin')],
25-
destroy: [middleware.authRole('admin')],
26-
query: [middleware.authRole('admin')]
32+
all: before.logParams,
33+
index: [before.exampleMiddleware],
34+
destroy: [before.exampleMiddleware]
2735
}
2836
};
2937

‎app/v2/routes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ module.exports.init = function(rootRoute) {
77
app.get(rootRoute + '/', function(req, res) {
88
res.send('hello from v2');
99
});
10-
}
10+
};

‎conf/test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ conf.redis = {
2020
conf.postgres = {
2121
database : 'api_test',
2222
port : 5432,
23-
uname : 'uname',
24-
pass : 'pass',
23+
uname : 'pagelever',
24+
pass : 'pagelever',
2525
logging : true
2626
};
2727

‎lib/cluster.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ var _ = require('lodash'),
1313
function Cluster() {
1414
_.bindAll(this);
1515
log = bunyan.createLogger({name: "cluster"});
16-
this.workerRestartArray = []
16+
this.workerRestartArray = [];
1717

1818
process.nextTick(this.start);
1919

2020
return this;
2121

22-
};
22+
}
2323

2424
/** @alias {Cluster.prototype.sysCluster} onto Cluster constructor for static ref */
2525
Cluster.prototype.sysCluster = Cluster.sysCluster = require('cluster');
@@ -43,8 +43,8 @@ Cluster.prototype.start = _.once(function () {
4343
// explicitly set worker number
4444
cluster.workers(numWorkers);
4545

46-
log.info('cluster: Spawning ' + numWorkers
47-
+ ' workers for ' + cpus + ' CPUs');
46+
log.info('cluster: Spawning ' + numWorkers +
47+
' workers for ' + cpus + ' CPUs');
4848

4949
// Restart workers when they die
5050
cluster.sysCluster.on('exit', cluster.restartWorker);
@@ -107,9 +107,9 @@ Cluster.prototype.restartWorker = function (worker, code, signal) {
107107
// delayed to prevent CPU explosions if crashes happen to quickly
108108
_.delay(function () {
109109
if (worker) {
110-
log.info('cluster: Worker ' + worker.id + ' (pid '
111-
+ worker.process.pid + ') ' + 'died ('
112-
+ worker.process.exitCode + '). Respawning..');
110+
log.info('cluster: Worker ' + worker.id + ' (pid ' +
111+
worker.process.pid + ') ' + 'died (' +
112+
worker.process.exitCode + '). Respawning..');
113113
}
114114

115115
cluster.sysCluster.fork();
@@ -118,7 +118,7 @@ Cluster.prototype.restartWorker = function (worker, code, signal) {
118118

119119
// workerRestartArray used for rolling restarts (SIGUSR2)
120120
if (cluster.workerRestartArray.length > 0) {
121-
var worker = cluster.workerRestartArray.shift();
121+
worker = cluster.workerRestartArray.shift();
122122
log.info("Sending 'stop' signal to worker " + worker.process.pid);
123123
// killing a worker will in-turn call restartWorker and restart itself.
124124
worker.send("stop");
@@ -187,6 +187,6 @@ Cluster.prototype.shutdown = function () {
187187
}
188188
process.exit();
189189
log.info('exiting ' + process.pid.toString());
190-
}
190+
};
191191

192192
exports = module.exports = Cluster;

‎lib/logger.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var bunyan = require('bunyan'),
22
_ = require('lodash'),
3-
url = require('url')
3+
url = require('url'),
44
mongo = require('mongodb'),
55
path = require('path'),
66
MongoClient = mongo.MongoClient;
@@ -39,27 +39,27 @@ function Logger(conf) {
3939
*/
4040
Logger.prototype.createLogger = function () {
4141
this.log = bunyan.createLogger({ name: this.conf.app.name });
42-
}
42+
};
4343

4444
Logger.prototype.trace = function (message) {
4545
this.write('trace', message);
46-
}
46+
};
4747

4848
Logger.prototype.info = function (message) {
4949
this.write('info', message);
50-
}
50+
};
5151

5252
Logger.prototype.warn = function (message) {
5353
this.write('warn', message);
54-
}
54+
};
5555

5656
Logger.prototype.error = function (message) {
5757
this.write('error', message);
58-
}
58+
};
5959

6060
Logger.prototype.fatal = function (message) {
6161
this.write('fatal', message);
62-
}
62+
};
6363

6464
/**
6565
* Writes to the designated log
@@ -73,8 +73,8 @@ Logger.prototype.write = function (level, message) {
7373

7474
_.each(this.enabled, function(method) {
7575
_this[method](level, message);
76-
})
77-
}
76+
});
77+
};
7878

7979

8080
/**
@@ -89,7 +89,7 @@ Logger.prototype.index = function (level, message) {
8989

9090
var indexMethod = 'index' + this.conf.logger.index.type;
9191
this[indexMethod](level, message);
92-
}
92+
};
9393

9494
Logger.prototype.indexMongo = function (level, message) {
9595
var _this = this;
@@ -108,6 +108,6 @@ Logger.prototype.indexMongo = function (level, message) {
108108
db.close();
109109
});
110110
});
111-
}
111+
};
112112

113113
exports = module.exports = Logger;

‎lib/middleware.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ middleware.mergeParams = function(req, res, next) {
2121
};
2222

2323

24-
exports = module.exports = middleware
24+
exports = module.exports = middleware;

‎lib/sequelizeResourceController.js

+17-16
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ _.str = require('underscore.string');
2222
function ResourceController(modelName, opts) {
2323
var db = app.locals.db;
2424
this.db = db;
25-
this.options = opts,
25+
this.options = opts;
2626
this.modelName = modelName; // user
2727
this.modelNamePlural = inflection.pluralize(this.modelName); // users
2828
this.ModelClass = db[_.str.capitalize(this.modelName)]; // User
2929
this.modelGetter = 'get' + _.str.capitalize(this.modelName); // getUser
3030
this.modelGetterPlural = inflection.pluralize(this.modelGetter); // getUsers
3131
this.modelSetter = 'set' + _.str.capitalize(this.modelName);
3232
this.modelSetterPlural = inflection.pluralize(this.modelSetter);
33-
this.log = new app.locals.Logger(app.locals.conf)
33+
this.log = new app.locals.Logger(app.locals.conf);
3434
this.dialect = 'postgres';
3535

3636
var scopeCheck = function(req, res, next) {
@@ -47,7 +47,7 @@ function ResourceController(modelName, opts) {
4747
if (this.options.before) {
4848
if (this.options.before && this.options.before.all) { // options.before.all exists
4949
if (_.isArray(this.options.before.all)) { // options.before.all is an Array, prepend it
50-
this.options.before.all.unshift(scopeCheck)
50+
this.options.before.all.unshift(scopeCheck);
5151
}
5252
else { // options.before.all is an Object, convert to an Array and prepend.
5353
this.options.before.all = [scopeCheck, this.options.before.all];
@@ -64,7 +64,7 @@ function ResourceController(modelName, opts) {
6464

6565
// maintains 'this' context throughout the class
6666
_.bindAll(this);
67-
};
67+
}
6868

6969
ResourceController.prototype.index = function(req, res) {
7070
var _this = this,
@@ -101,7 +101,7 @@ ResourceController.prototype.index = function(req, res) {
101101
.error(function (err) { _this.sendErr(res, 'index', err); })
102102
.success(function (result, created) {
103103
if (result.length === 1)
104-
return res.send(result[0])
104+
return res.send(result[0]);
105105
res.send(result);
106106
});
107107
}
@@ -146,7 +146,7 @@ ResourceController.prototype.new = function(req, res) {
146146
ResourceController.prototype.create = function(req, res) {
147147
var action = 'create',
148148
params = req.body,
149-
modelParam = params[this.modelName] // { theModelName : { attr : value }}
149+
modelParam = params[this.modelName]; // { theModelName : { attr : value }}
150150
_this = this;
151151

152152
if (_.isEmpty(modelParam)) return _this.sendErr(res, action, 'no ' + this.modelName + ' parameter supplied');
@@ -222,15 +222,15 @@ ResourceController.prototype.update = function(req, res) {
222222
var setKeys = _.keys(params.update); // ['key', 'key2', 'key3']
223223
var setString = '';
224224
var setArray = _.map(setKeys, function(key) { // [ '"name"=\'Bob\'','"age=16"', '"desc"=\'A user\'' ]
225-
var value = params.update[key]
225+
var value = params.update[key];
226226
value = _.isNumber(params.update[key]) ? value : SqlString.escape(value, null, null, _this.dialect);
227227
return "\"" + key + "\"=" + value;
228228
});
229229

230230
if (setArray.length > 1) {
231231
// "name"='Bob',"age=16"
232232
setString += setArray.shift();
233-
_.each(setArray, function(setter) { setString += (',' + setter) ;})
233+
_.each(setArray, function(setter) { setString += (',' + setter); });
234234

235235
} else {
236236
// "name"='Bob'
@@ -239,10 +239,10 @@ ResourceController.prototype.update = function(req, res) {
239239

240240

241241
// :/ this gets us the relational piece of the update query
242-
var query = 'UPDATE ' + this.modelNamePlural + ' SET ' + setString
243-
+ ' WHERE id IN (SELECT "' + this.modelName + 'Id"'
244-
+ ' FROM ' + this.modelNamePlural + inflection.pluralize(req.scope.daoFactory.name)
245-
+ ' WHERE "' + req.scope.daoFactory.name + 'Id" = ' + req.scope.id + ')';
242+
var query = 'UPDATE ' + this.modelNamePlural + ' SET ' + setString +
243+
' WHERE id IN (SELECT "' + this.modelName + 'Id"' +
244+
' FROM ' + this.modelNamePlural + inflection.pluralize(req.scope.daoFactory.name) +
245+
' WHERE "' + req.scope.daoFactory.name + 'Id" = ' + req.scope.id + ')';
246246

247247

248248
if (_.isEmpty(params.where)) {
@@ -263,7 +263,7 @@ ResourceController.prototype.update = function(req, res) {
263263
query += whereQuery;
264264
}
265265
_this.db.sequelize.query(query)
266-
.error(function (err) { _this.sendErr(res, action, err) })
266+
.error(function (err) { _this.sendErr(res, action, err); })
267267
.success(function () {
268268
res.send({ status : 'success' });
269269
});
@@ -337,16 +337,17 @@ ResourceController.prototype.query = function(req, res) {
337337
ResourceController.prototype.describe = function(req, res) {
338338
var data = this.db.describe(this.ModelClass);
339339

340-
if (data == null)
340+
if (data === null) {
341341
data = { error : 'This model does not exist' };
342+
}
342343

343344
res.setHeader('Sequelize-Admin', JSON.stringify(data));
344345
res.end();
345346
};
346347

347348
ResourceController.prototype.getLogger = function () {
348349
return this.log;
349-
}
350+
};
350351

351352
function isInt(arg) {
352353
var intRegex = /^\d+$/;
@@ -362,6 +363,6 @@ ResourceController.prototype.sendErr = function (res, action, msg) {
362363

363364
this.log.error(err);
364365
res.send(err);
365-
}
366+
};
366367

367368
exports = module.exports = ResourceController;

‎main.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ versions = {'Version 1': '/v1',
7171
// route to display versions
7272
app.get('/', function(req, res) {
7373
res.json(versions);
74-
})
74+
});
7575

7676
// import and apply the routes
7777
for (var k in versions) {
@@ -81,7 +81,7 @@ for (var k in versions) {
8181

8282
app.locals.db.sequelize.sync().complete(function(err) {
8383
if (err) {
84-
throw err
84+
throw err;
8585
} else {
8686
if (isProduction()) { // only run clustered in prod
8787
new Cluster()
@@ -113,7 +113,7 @@ function isTest() {
113113
/* Initialization */
114114
function startServer() {
115115
http.createServer(app).listen(conf.server.port.http, function(){
116-
console.log('Express server listening on port ' + conf.server.port.http)
116+
console.log('Express server listening on port ' + conf.server.port.http);
117117
});
118118
}
119119

‎models/account.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ module.exports = function(sequelize, DataTypes) {
22
return sequelize.define("account", {
33
name: DataTypes.STRING,
44
description: DataTypes.STRING
5-
})
6-
}
5+
});
6+
};

‎models/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = function(conf) {
5454
var ScopeClass, scopeName, models, paramKeys;
5555

5656
// build an array of all the model names available - the model name in question
57-
possibleScopes = _.reject(db.modelNames, function(m) { return m === modelName});
57+
possibleScopes = _.reject(db.modelNames, function(m) { return m === modelName; });
5858
// parse the passed param names (keys)
5959
paramKeys = _.keys(params);
6060
// find the scopeName ie) GET /users/:user/accounts : scopeName=user
@@ -105,4 +105,4 @@ module.exports = function(conf) {
105105
db.Account.hasMany(db.User);
106106

107107
return db;
108-
}
108+
};

‎models/user.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ module.exports = function(sequelize, DataTypes) {
22
return sequelize.define("user", {
33
username: DataTypes.STRING,
44
age : DataTypes.INTEGER
5-
})
6-
}
5+
});
6+
};

‎package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@
2828
"devDependencies": {
2929
"supertest": "~0.8.2",
3030
"chai": "~1.8.1",
31-
"mocha": "~1.15.1"
31+
"mocha": "~1.15.1",
32+
"grunt-contrib-watch": "^0.6.1",
33+
"grunt": "^0.4.5",
34+
"grunt-apidoc": "^0.6.0",
35+
"grunt-contrib-jshint": "^0.10.0"
3236
},
3337
"scripts": {
3438
"start": "axle node main.js",
35-
"test": "mocha --timeout 5000 --reporter nyan"
39+
"test": "NODE_ENV=test mocha --timeout 5000 --reporter spec --ui bdd"
3640
}
3741
}

‎test/accounts.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
process.env.NODE_ENV = 'test'
2-
31
var should = require('chai').should(),
42
supertest = require('supertest'),
53
app = require('../main'),
@@ -14,16 +12,17 @@ var should = require('chai').should(),
1412
var randomString = function () {
1513
var result = '',
1614
length = 5,
17-
chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\'"!@#$%^&*()-_+=.,;:></?[]{}\\`~|'
15+
chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\'"!@#$%^&*()-_+=.,;:></?[]{}\\`~|';
16+
1817
for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
1918
return result + chars;
20-
}
19+
};
2120

2221
describe('The AccountsController works', function() {
2322
before(function (done) {
2423
db.sequelize.sync().complete(function(err) {
2524
if (err) {
26-
throw err
25+
throw err;
2726
} else {
2827
db.sequelize.query("DELETE FROM accounts")
2928
.error(function (err) {

‎test/users.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
process.env.NODE_ENV = 'test'
2-
31
var should = require('chai').should(),
42
supertest = require('supertest'),
53
app = require('../main'),
@@ -145,7 +143,7 @@ describe('User Associations', function() {
145143
before(function (done) {
146144
db.sequelize.sync().complete(function(err) {
147145
if (err) {
148-
throw err
146+
throw err;
149147
}
150148
else {
151149
db.sequelize.query("DELETE FROM users")

‎test/utils/modelBuilder.js

+20-25
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ ModelBuilder.prototype.build = function(modelName) {
1515
keys = ModelClass.rawAttributes,
1616
mock;
1717

18-
this.digitsRegex = /\((.*?)\)/
18+
this.digitsRegex = /\((.*?)\)/;
1919
keys = _.omit(keys, ['createdAt', 'updatedAt', 'id']);
2020
mock = _.mapValues(keys, function(v) { return _this.getType(v.toString()); });
2121

2222
return mock;
23-
}
23+
};
2424

2525
ModelBuilder.prototype.getType = function(type) {
2626
var types = {
@@ -38,21 +38,23 @@ ModelBuilder.prototype.getType = function(type) {
3838
};
3939

4040
if (_.str.startsWith(type, 'TINYB')) {
41-
return types['TINY'](type);
41+
return types.TINY(type);
4242
} else {
4343
return types[type.substring(0,3)](type);
4444
}
4545

46-
}
46+
};
47+
4748
ModelBuilder.prototype.randomString = function (length) {
4849
var result = '',
49-
chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\'"!@#$%^&*()-_+=.,;:></?[]{}\\`~|'
50+
chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\'"!@#$%^&*()-_+=.,;:></?[]{}\\`~|';
51+
5052
for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
5153

5254
console.log('RANDOM STRING GENERATED');
5355
console.log(result);
5456
return result;
55-
}
57+
};
5658

5759
ModelBuilder.prototype.randomNumber = function (precision, scale) {
5860
var result;
@@ -63,7 +65,7 @@ ModelBuilder.prototype.randomNumber = function (precision, scale) {
6365
}
6466

6567
return parseFloat(result);
66-
}
68+
};
6769

6870
ModelBuilder.prototype.getVarChar = function(type) {
6971
var digits;
@@ -76,23 +78,21 @@ ModelBuilder.prototype.getVarChar = function(type) {
7678
}
7779

7880
return this.randomString(digits);
79-
}
81+
};
8082

8183
ModelBuilder.prototype.getText = function() {
82-
83-
}
84+
};
8485

8586
ModelBuilder.prototype.getInt = function(type) {
8687
return Math.random() * 100|0;
87-
}
88+
};
8889

8990
ModelBuilder.prototype.getBigInt = function() {
90-
91-
}
91+
};
9292

9393
ModelBuilder.prototype.getFloat = function(type) {
9494
return Math.random() * 100;
95-
}
95+
};
9696

9797
ModelBuilder.prototype.getDecimal = function(type) {
9898
var digits, result;
@@ -106,26 +106,21 @@ ModelBuilder.prototype.getDecimal = function(type) {
106106
}
107107

108108
return result;
109-
}
109+
};
110110

111111
ModelBuilder.prototype.getDateTime = function() {
112-
113-
}
112+
};
114113

115114
ModelBuilder.prototype.getTinyInt = function() {
116-
117-
}
115+
};
118116

119117
ModelBuilder.prototype.getEnum = function() {
120-
121-
}
118+
};
122119

123120
ModelBuilder.prototype.getBlob = function() {
124-
125-
}
121+
};
126122

127123
ModelBuilder.prototype.getTinyBlob = function() {
128-
129-
}
124+
};
130125

131126
exports = module.exports = ModelBuilder;

‎test/utils/testUtil.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ TestUtil.prototype.clean = function(callback) {
99
var _this = this;
1010
_this.db.sequelize.sync().complete(function(err) {
1111
if (err) {
12-
throw err
12+
throw err;
1313
} else {
1414
_this.db.sequelize.query("SELECT * FROM pg_catalog.pg_tables")
1515
.error(function (err) {
@@ -37,6 +37,6 @@ TestUtil.prototype.clean = function(callback) {
3737
});
3838
}
3939
});
40-
}
40+
};
4141

4242
exports = module.exports = TestUtil;

0 commit comments

Comments
 (0)
Please sign in to comment.