Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller class upgrade #33

Merged
merged 38 commits into from
Jun 26, 2017
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9747bec
Test seeding overhaul, routes authorized, misc test fixes
olkorhon Dec 19, 2016
71a0912
Cleanup, unified formatting, reduced use of own code
olkorhon Dec 20, 2016
84dd6e0
WIP
jupe Jan 8, 2017
47622b7
update seeds readme
jupe Jan 8, 2017
2f2e7ff
rename seeds readme to md file
jupe Jan 8, 2017
080870c
update readme
jupe Jan 8, 2017
1a1e62e
move test seeds under test folder
jupe Jan 8, 2017
7be0bc5
create test data only with cli option seeds
jupe Jan 8, 2017
e4a7938
fixed failing tests caused by invalid dummy database restore and a si…
olkorhon May 30, 2017
97dcacf
made the grunt default test task include dummy database restore
olkorhon May 30, 2017
a4290db
created a separate shell script for linux machines
May 31, 2017
024250e
increased logging level, database still not restoring for some reason
May 31, 2017
d6de05b
removed obsolete --quiet parameter from mongorestore exec
May 31, 2017
658261f
Merge branch 'master' into ensure_auth
olkorhon May 31, 2017
5806b1e
cleanup for controllers
Jun 2, 2017
07bd181
cleaned configs
Jun 2, 2017
6220c65
reverted item schema barcode back to sparse unique, also resuppressed…
Jun 7, 2017
49c2653
in progress commit: index, campaigns, resources and testcases converted
Jun 8, 2017
57044f8
Merge branch 'master' into controller-class-upgrade
Jun 8, 2017
f2e8e8f
converted rest of controllers to classes, authentication needs more t…
Jun 8, 2017
4b91b2d
authentication errors fixed
Jun 8, 2017
cde573d
class conversion of missed controllers and overall code style cleanup
Jun 9, 2017
a3d40d1
reformatted testing structure, added unittests for controllers/index.…
Jun 12, 2017
5b6f40c
reverted _model.find back to necessary .query, changed test reporter …
Jun 13, 2017
2007a69
modified test to purge a global variable leaked from thirdparty library
Jun 13, 2017
82a4f6c
added unittests for items.js, logic error fixed from items.js and als…
Jun 13, 2017
a74ed48
add unit tests for loans.js, fixed bug caused by _handleItemsInUpdate…
Jun 14, 2017
4c3f9fd
added unittests for several trivial controllers, refactored mock stru…
Jun 15, 2017
432a50c
add unittests for results, had to rewrite and fix results controller.…
Jun 19, 2017
8ca0e09
refactored async in favor of Promises away from unittests + converted…
Jun 20, 2017
35c1e7d
tests timeout, increasing timeout to see if that is the issue.
Jun 20, 2017
aeb6dda
community has had similar problems with timeouts, one member had luck…
Jun 20, 2017
7734c26
defined specific dbversion for all unittests.
Jun 20, 2017
7e809eb
forgot to save one file, thus it didn't make it to the commit
Jun 20, 2017
1458d6f
lintified gruntfile and overall final cleanups
Jun 21, 2017
1f92cfb
unittests for overlooked resources.js + index.js: ensured db reset pr…
Jun 21, 2017
6eb13e8
removed unused library dependency
Jun 21, 2017
982d328
fixed winston logging level issues and refactored nconf calls to the …
Jun 26, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const fs = require('fs');


module.exports = function(grunt) {
var testFiles = ["test/*.js"];
var testFilesApi = ["test/tests_api/*.js"];
var testFilesUnit = ["test/tests_unittests/*.js"];

grunt.initConfig({
express: {
Expand All @@ -29,28 +30,29 @@ module.exports = function(grunt) {
exec: {
restore_db: {
cmd: './scripts/dbrestore_linux.sh local ./test/seeds/test_dump/',
stdout: true,
stdout: false,
stderr: true,
options: {
shell: 'bash'
}
options: {
shell: 'bash',
}
}
},
simplemocha: {
options: {
globals: ["should"],
timeout: 3000,
timeout: 120000,
ignoreLeaks: false,
ui: "bdd",
reporter: "xunit-file"
},
all: {
src: testFiles
api: {
src: testFilesApi
},
unit: {
src: testFilesUnit
}
}
},
});

grunt.registerTask('FindTests', 'Find all tests under the addons', function() {
grunt.registerTask('FindApiTests', 'Find all tests under the addons', function() {
var root = "app/addons";
(function walk(path) {
var items = fs.readdirSync(path);
Expand All @@ -63,7 +65,7 @@ module.exports = function(grunt) {
if ((dirName.match(/\//g) || []).length === 3) {
// only add test js files that are in the root of the /test directory.
// if you need to include subdirs, modify this to: dirName + '/' + '**/*.js'
testFiles.push(dirName + '/' + '*.js');
testFilesApi.push(dirName + '/' + '*.js');
}
}
walk(path + '/' + item);
Expand All @@ -76,6 +78,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-express-server");
grunt.loadNpmTasks("grunt-exec");
grunt.loadNpmTasks("grunt-simple-mocha");
grunt.registerTask("default", ["FindTests", "express:test", "waitServer", "exec", "simplemocha:all"]);
grunt.registerTask("no-db-restore", ["FindTests", "express:test", "waitServer", "simplemocha:all"]);
grunt.registerTask("default", ["simplemocha:unit", "FindApiTests", "express:test", "waitServer", "exec", "simplemocha:api"]);
grunt.registerTask("apitests", ["FindApiTests", "express:test", "waitServer", "exec", "simplemocha:api"]);
grunt.registerTask("unittests", ["simplemocha:unit"]);
};
10 changes: 5 additions & 5 deletions app/controllers/apikeys.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var _ = require('lodash');
var mongoose = require('mongoose');
const _ = require('lodash');
const mongoose = require('mongoose');

var User = mongoose.model('User');
var ApiKey = mongoose.model('ApiKey');
const User = mongoose.model('User');
const ApiKey = mongoose.model('ApiKey');

module.exports = {
keys: (req, res) => {
Expand Down Expand Up @@ -38,7 +38,7 @@ module.exports = {
return res.status(401).send({ message: error });
}

return res.send({ ok: ok });
return res.send({ ok });
});
},
};
Loading