added node-coveralls to package.json

This commit is contained in:
David Baldwynn 2015-11-23 13:06:02 -08:00
parent 14c9b00d67
commit 73c87a2301
24 changed files with 335 additions and 339 deletions

View file

@ -86,11 +86,21 @@ $ grunt test:client
Currently the live example uses heroku github deployments. The Docker file is out of date and does not work. If someone wishes to get it working feel free to submit a pull request.
To calculate your code coverage with Istanbul, run the coverage task
To calculate your total test coverage with Istanbul, run the coverage task
```bash
$ grunt coverage
```
To calculate your server-side test coverage with Istanbul, run the coverage task
```bash
$ grunt coverage:server
```
To calculate your client-side test coverage with Istanbul, run the coverage task
```bash
$ grunt coverage:client
```
## Running in a secure environment
To run your application in a secure manner you'll need to use OpenSSL and generate a set of self-signed certificates. Unix-based users can use the following command:
```bash

View file

@ -107,7 +107,7 @@ exports.createSubmission = function(req, res) {
percentageComplete: req.body.percentageComplete
});
if(!!form.plugins.oscarhost.baseUrl) submission.hasPlugins.oscarhost == true;
if(!!form.plugins.oscarhost.baseUrl) submission.hasPlugins.oscarhost = true;
if(form.pdf) submission.pdf = form.pdf;
@ -222,7 +222,7 @@ exports.update = function(req, res) {
if(req.user.roles.indexOf('admin') === -1) delete req.body.form.admin;
//Do this so we can create duplicate fields
var checkForValidId = new RegExp("^[0-9a-fA-F]{24}$");
var checkForValidId = new RegExp('^[0-9a-fA-F]{24}$');
for(var i=0; i<req.body.form.form_fields.length; i++){
var field = req.body.form.form_fields[i];
if(!checkForValidId.exec(field._id+'')){

View file

@ -359,12 +359,14 @@ FormSchema.pre('save', function (next) {
next();
});
}else if(_original.hasOwnProperty('pdf')){
fs.remove(_original.pdf.path, function (err) {
if(err) next(err);
console.log('file at '+_original.pdf.path+' successfully deleted');
next();
});
}else if(_original){
if(_original.hasOwnProperty('pdf')){
fs.remove(_original.pdf.path, function (err) {
if(err) next(err);
console.log('file at '+_original.pdf.path+' successfully deleted');
next();
});
}
}
next();
});

View file

@ -20,39 +20,42 @@ var BooleanExpressionSchema = new Schema({
BooleanExpressionSchema.methods.evaluate = function(){
if(this.expressionString)
//Get headNode
var headNode = math.parse(this.expressionString);
var expressionScope = {};
var that = this;
//Get headNode
var headNode = math.parse(expressionString);
var expressionScope = {};
var that = this;
//Create scope
headNode.traverse(function (node, path, parent) {
if(node.type === 'SymbolNode'){
//Create scope
headNode.traverse(function (node, path, parent) {
if(node.type === 'SymbolNode'){
mongoose.model('Field')
.findOne({_id: node.name}).exec(function(err, field){
if(err) {
console.log(err);
throw new Error(err);
}
mongoose.model('Field')
.findOne({_id: node.name}).exec(function(err, field){
if(err) {
console.log(err);
throw new Error(err);
}
if(!!_.parseInt(field.fieldValue)){
that.expressionScope[node.name] = _.parseInt(field.fieldValue);
}else {
that.expressionScope[node.name] = field.fieldValue;
}
console.log('_id: '+node.name);
console.log('value: '+that.expressionScope[node.name]);
});
}
});
if(!!_.parseInt(field.fieldValue)){
that.expressionScope[node.name] = _.parseInt(field.fieldValue);
}else {
that.expressionScope[node.name] = field.fieldValue;
}
console.log('_id: '+node.name);
console.log('value: '+that.expressionScope[node.name]);
});
}
});
var code = headNode.compile();
var result = code.eval(expressionScope);
var code = headNode.compile();
var result = code.eval(expressionScope);
this.result = result;
return result;
this.result = result;
return result;
}else{
return null;
}
};
mongoose.model('BooleanExpression', BooleanExpressionSchema);

View file

@ -39,7 +39,7 @@ var exampleDemo = {
patientStatusDate: Date.now(),
phone: '250-',
phone2: '',
postal: "S4M 7T8",
postal: 'S4M 7T8',
providerNo: '4',
province: 'BC',
rosterStatus: '',
@ -49,7 +49,7 @@ var exampleDemo = {
spokenLanguage: 'English',
title: 'MS.',
yearOfBirth: '2015'
}
};
/**
* Globals

View file

@ -29,7 +29,7 @@ var exampleDemo = {
officialLanguage: 'English',
phone: '250-222-2222',
phone2: '',
postal: "S4M 7T8",
postal: 'S4M 7T8',
province: 'BC',
sex: 'F',
sexDesc: 'Female',
@ -37,7 +37,7 @@ var exampleDemo = {
spokenLanguage: 'English',
title: 'MS.',
yearOfBirth: '2015'
}
};
var sampleFormFields = [
@ -308,6 +308,6 @@ describe('FormSubmission Model Unit Tests:', function() {
User.remove().exec(function() {
FormSubmission.remove().exec(done);
});
})
});
});
});

View file

@ -48,10 +48,11 @@ describe('User CRUD tests', function() {
email: credentials.username,
username: credentials.username,
password: credentials.password,
provider: 'local'
};
});
describe('Create, Verify and Activate a User', function() {
describe(' > Create, Verify and Activate a User > ', function() {
var username = 'testActiveAccount1.be1e58fb@mailosaur.in';
var link, _tmpUser, activateToken;
this.timeout(15000);
@ -124,7 +125,7 @@ describe('User CRUD tests', function() {
});
});
it('should be able to verify a User Account', function(done) {
it(' > should be able to verify a User Account', function(done) {
console.log('activateToken: '+activateToken);
userSession.get('/auth/verify/'+activateToken)
.expect(200)
@ -136,63 +137,36 @@ describe('User CRUD tests', function() {
});
});
// it('should receive confirmation email after verifying a User Account', function(done) {
// mailbox.getEmails(function(err, _emails) {
// if(err) throw err;
// var email = _emails[0];
it(' > should be able to login and logout a verified User Account', function(done) {
userSession.post('/auth/signin')
.send(credentials)
.expect('Content-Type', /json/)
.expect(200)
.end(function(signinErr, signinRes) {
// Handle signin error
if (signinErr) done(signinErr);
// // console.log('mailbox.getEmails:');
// console.log(email);
// (email.subject).should.equal('Account successfully verified!');
// done();
// });
// });
var user = signinRes.body;
(user.username).should.equal(credentials.username);
userSession.get('/auth/signout')
.expect(200)
.end(function(signoutErr, signoutRes) {
// Handle signout error
if (signoutErr) done(signoutErr);
(signoutRes.text).should.equal('Successfully logged out');
done();
});
});
});
});
it('should be able to login and logout a User', function (done) {
var username = 'testActiveAccount.be1e58fb@mailosaur.in';
// _User.email = _User.username = credentials.username = username;
// Create a new user
var newUser = {
firstName: 'Full',
lastName: 'Name',
email: credentials.username,
username: credentials.username,
password: credentials.password,
};
userSession.post('/auth/signup')
.send(newUser)
.expect(200)
.end(function(FormSaveErr, FormSaveRes) {
(FormSaveRes.text).should.equal('An email has been sent to you. Please check it to verify your account.');
it(' > should be able to reset a User\'s password');
userSession.post('/auth/signin')
.send(credentials)
.expect('Content-Type', /json/)
.expect(200)
.end(function(signinErr, signinRes) {
// Handle signin error
if (signinErr) throw signinErr;
userSession.get('/auth/signout')
.expect(200)
.end(function(signoutErr, signoutRes) {
// Handle signout error
if (signoutErr) throw signoutErr;
(signoutRes.text).should.equal('Successfully logged out');
done();
});
});
});
});
it('should be able to reset a User\'s password');
it('should be able to delete a User account without any problems');
it(' > should be able to delete a User account without any problems');
afterEach(function(done) {
User.remove().exec(function () {

View file

@ -50,7 +50,7 @@ module.exports.getGlobbedFiles = function(globPatterns, removeRoot) {
if (urlRegex.test(globPatterns)) {
output.push(globPatterns);
} else {
var files = glob.sync(globPatterns)
var files = glob.sync(globPatterns);
if (removeRoot) {
files = files.map(function(file) {
return file.replace(removeRoot, '');

View file

@ -37,6 +37,11 @@ module.exports = function(db) {
require(path.resolve(modelPath));
});
// Globbing routing files
config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
require(path.resolve(routePath))(app);
});
// Setting application local variables
app.locals.title = config.app.title;
app.locals.description = config.app.description;
@ -135,11 +140,6 @@ module.exports = function(db) {
// connect flash for flash messages
app.use(flash());
// Globbing routing files
config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
require(path.resolve(routePath))(app);
});
// Add headers for Sentry
app.use(function (req, res, next) {

View file

@ -1,41 +1,41 @@
'use strict';
// 'use strict';
/**
* Module dependencies.
*/
var passport = require('passport'),
FacebookStrategy = require('passport-facebook').Strategy,
config = require('../config'),
users = require('../../app/controllers/users.server.controller');
// /**
// * Module dependencies.
// */
// var passport = require('passport'),
// FacebookStrategy = require('passport-facebook').Strategy,
// config = require('../config'),
// users = require('../../app/controllers/users.server.controller');
module.exports = function() {
// Use facebook strategy
passport.use(new FacebookStrategy({
clientID: config.facebook.clientID,
clientSecret: config.facebook.clientSecret,
callbackURL: config.facebook.callbackURL,
passReqToCallback: true
},
function(req, accessToken, refreshToken, profile, done) {
// Set the provider data and include tokens
var providerData = profile._json;
providerData.accessToken = accessToken;
providerData.refreshToken = refreshToken;
// module.exports = function() {
// // Use facebook strategy
// passport.use(new FacebookStrategy({
// clientID: config.facebook.clientID,
// clientSecret: config.facebook.clientSecret,
// callbackURL: config.facebook.callbackURL,
// passReqToCallback: true
// },
// function(req, accessToken, refreshToken, profile, done) {
// // Set the provider data and include tokens
// var providerData = profile._json;
// providerData.accessToken = accessToken;
// providerData.refreshToken = refreshToken;
// Create the user OAuth profile
var providerUserProfile = {
firstName: profile.name.givenName,
lastName: profile.name.familyName,
displayName: profile.displayName,
email: profile.emails[0].value,
username: profile.username,
provider: 'facebook',
providerIdentifierField: 'id',
providerData: providerData
};
// // Create the user OAuth profile
// var providerUserProfile = {
// firstName: profile.name.givenName,
// lastName: profile.name.familyName,
// displayName: profile.displayName,
// email: profile.emails[0].value,
// username: profile.username,
// provider: 'facebook',
// providerIdentifierField: 'id',
// providerData: providerData
// };
// Save the user OAuth profile
users.saveOAuthUserProfile(req, providerUserProfile, done);
}
));
};
// // Save the user OAuth profile
// users.saveOAuthUserProfile(req, providerUserProfile, done);
// }
// ));
// };

View file

@ -1,46 +1,46 @@
'use strict';
// 'use strict';
/**
* Module dependencies.
*/
var passport = require('passport'),
GithubStrategy = require('passport-github').Strategy,
config = require('../config'),
users = require('../../app/controllers/users.server.controller');
// /**
// * Module dependencies.
// */
// var passport = require('passport'),
// GithubStrategy = require('passport-github').Strategy,
// config = require('../config'),
// users = require('../../app/controllers/users.server.controller');
module.exports = function() {
// Use github strategy
passport.use(new GithubStrategy({
clientID: config.github.clientID,
clientSecret: config.github.clientSecret,
callbackURL: config.github.callbackURL,
passReqToCallback: true
},
function(req, accessToken, refreshToken, profile, done) {
// Set the provider data and include tokens
var providerData = profile._json;
providerData.accessToken = accessToken;
providerData.refreshToken = refreshToken;
// module.exports = function() {
// // Use github strategy
// passport.use(new GithubStrategy({
// clientID: config.github.clientID,
// clientSecret: config.github.clientSecret,
// callbackURL: config.github.callbackURL,
// passReqToCallback: true
// },
// function(req, accessToken, refreshToken, profile, done) {
// // Set the provider data and include tokens
// var providerData = profile._json;
// providerData.accessToken = accessToken;
// providerData.refreshToken = refreshToken;
// Create the user OAuth profile
var displayName = profile.displayName.trim();
var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName
var firstName = iSpace !== -1 ? displayName.substring(0, iSpace) : displayName;
var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : '';
// // Create the user OAuth profile
// var displayName = profile.displayName.trim();
// var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName
// var firstName = iSpace !== -1 ? displayName.substring(0, iSpace) : displayName;
// var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : '';
var providerUserProfile = {
firstName: firstName,
lastName: lastName,
displayName: displayName,
email: profile.emails[0].value,
username: profile.username,
provider: 'github',
providerIdentifierField: 'id',
providerData: providerData
};
// var providerUserProfile = {
// firstName: firstName,
// lastName: lastName,
// displayName: displayName,
// email: profile.emails[0].value,
// username: profile.username,
// provider: 'github',
// providerIdentifierField: 'id',
// providerData: providerData
// };
// Save the user OAuth profile
users.saveOAuthUserProfile(req, providerUserProfile, done);
}
));
};
// // Save the user OAuth profile
// users.saveOAuthUserProfile(req, providerUserProfile, done);
// }
// ));
// };

View file

@ -1,41 +1,41 @@
'use strict';
// 'use strict';
/**
* Module dependencies.
*/
var passport = require('passport'),
GoogleStrategy = require('passport-google-oauth').OAuth2Strategy,
config = require('../config'),
users = require('../../app/controllers/users.server.controller');
// /**
// * Module dependencies.
// */
// var passport = require('passport'),
// GoogleStrategy = require('passport-google-oauth').OAuth2Strategy,
// config = require('../config'),
// users = require('../../app/controllers/users.server.controller');
module.exports = function() {
// Use google strategy
passport.use(new GoogleStrategy({
clientID: config.google.clientID,
clientSecret: config.google.clientSecret,
callbackURL: config.google.callbackURL,
passReqToCallback: true
},
function(req, accessToken, refreshToken, profile, done) {
// Set the provider data and include tokens
var providerData = profile._json;
providerData.accessToken = accessToken;
providerData.refreshToken = refreshToken;
// module.exports = function() {
// // Use google strategy
// passport.use(new GoogleStrategy({
// clientID: config.google.clientID,
// clientSecret: config.google.clientSecret,
// callbackURL: config.google.callbackURL,
// passReqToCallback: true
// },
// function(req, accessToken, refreshToken, profile, done) {
// // Set the provider data and include tokens
// var providerData = profile._json;
// providerData.accessToken = accessToken;
// providerData.refreshToken = refreshToken;
// Create the user OAuth profile
var providerUserProfile = {
firstName: profile.name.givenName,
lastName: profile.name.familyName,
displayName: profile.displayName,
email: profile.emails[0].value,
username: profile.username,
provider: 'google',
providerIdentifierField: 'id',
providerData: providerData
};
// // Create the user OAuth profile
// var providerUserProfile = {
// firstName: profile.name.givenName,
// lastName: profile.name.familyName,
// displayName: profile.displayName,
// email: profile.emails[0].value,
// username: profile.username,
// provider: 'google',
// providerIdentifierField: 'id',
// providerData: providerData
// };
// Save the user OAuth profile
users.saveOAuthUserProfile(req, providerUserProfile, done);
}
));
};
// // Save the user OAuth profile
// users.saveOAuthUserProfile(req, providerUserProfile, done);
// }
// ));
// };

View file

@ -1,42 +1,42 @@
'use strict';
// 'use strict';
/**
* Module dependencies.
*/
var passport = require('passport'),
LinkedInStrategy = require('passport-linkedin').Strategy,
config = require('../config'),
users = require('../../app/controllers/users.server.controller');
// /**
// * Module dependencies.
// */
// var passport = require('passport'),
// LinkedInStrategy = require('passport-linkedin').Strategy,
// config = require('../config'),
// users = require('../../app/controllers/users.server.controller');
module.exports = function() {
// Use linkedin strategy
passport.use(new LinkedInStrategy({
consumerKey: config.linkedin.clientID,
consumerSecret: config.linkedin.clientSecret,
callbackURL: config.linkedin.callbackURL,
passReqToCallback: true,
profileFields: ['id', 'first-name', 'last-name', 'email-address']
},
function(req, accessToken, refreshToken, profile, done) {
// Set the provider data and include tokens
var providerData = profile._json;
providerData.accessToken = accessToken;
providerData.refreshToken = refreshToken;
// module.exports = function() {
// // Use linkedin strategy
// passport.use(new LinkedInStrategy({
// consumerKey: config.linkedin.clientID,
// consumerSecret: config.linkedin.clientSecret,
// callbackURL: config.linkedin.callbackURL,
// passReqToCallback: true,
// profileFields: ['id', 'first-name', 'last-name', 'email-address']
// },
// function(req, accessToken, refreshToken, profile, done) {
// // Set the provider data and include tokens
// var providerData = profile._json;
// providerData.accessToken = accessToken;
// providerData.refreshToken = refreshToken;
// Create the user OAuth profile
var providerUserProfile = {
firstName: profile.name.givenName,
lastName: profile.name.familyName,
displayName: profile.displayName,
email: profile.emails[0].value,
username: profile.username,
provider: 'linkedin',
providerIdentifierField: 'id',
providerData: providerData
};
// // Create the user OAuth profile
// var providerUserProfile = {
// firstName: profile.name.givenName,
// lastName: profile.name.familyName,
// displayName: profile.displayName,
// email: profile.emails[0].value,
// username: profile.username,
// provider: 'linkedin',
// providerIdentifierField: 'id',
// providerData: providerData
// };
// Save the user OAuth profile
users.saveOAuthUserProfile(req, providerUserProfile, done);
}
));
};
// // Save the user OAuth profile
// users.saveOAuthUserProfile(req, providerUserProfile, done);
// }
// ));
// };

View file

@ -1,45 +1,45 @@
'use strict';
// 'use strict';
/**
* Module dependencies.
*/
var passport = require('passport'),
TwitterStrategy = require('passport-twitter').Strategy,
config = require('../config'),
users = require('../../app/controllers/users.server.controller');
// /**
// * Module dependencies.
// */
// var passport = require('passport'),
// TwitterStrategy = require('passport-twitter').Strategy,
// config = require('../config'),
// users = require('../../app/controllers/users.server.controller');
module.exports = function() {
// Use twitter strategy
passport.use(new TwitterStrategy({
consumerKey: config.twitter.clientID,
consumerSecret: config.twitter.clientSecret,
callbackURL: config.twitter.callbackURL,
passReqToCallback: true
},
function(req, token, tokenSecret, profile, done) {
// Set the provider data and include tokens
var providerData = profile._json;
providerData.token = token;
providerData.tokenSecret = tokenSecret;
// module.exports = function() {
// // Use twitter strategy
// passport.use(new TwitterStrategy({
// consumerKey: config.twitter.clientID,
// consumerSecret: config.twitter.clientSecret,
// callbackURL: config.twitter.callbackURL,
// passReqToCallback: true
// },
// function(req, token, tokenSecret, profile, done) {
// // Set the provider data and include tokens
// var providerData = profile._json;
// providerData.token = token;
// providerData.tokenSecret = tokenSecret;
// Create the user OAuth profile
var displayName = profile.displayName.trim();
var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName
var firstName = iSpace !== -1 ? displayName.substring(0, iSpace) : displayName;
var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : '';
// // Create the user OAuth profile
// var displayName = profile.displayName.trim();
// var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName
// var firstName = iSpace !== -1 ? displayName.substring(0, iSpace) : displayName;
// var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : '';
var providerUserProfile = {
firstName: firstName,
lastName: lastName,
displayName: displayName,
username: profile.username,
provider: 'twitter',
providerIdentifierField: 'id_str',
providerData: providerData
};
// var providerUserProfile = {
// firstName: firstName,
// lastName: lastName,
// displayName: displayName,
// username: profile.username,
// provider: 'twitter',
// providerIdentifierField: 'id_str',
// providerData: providerData
// };
// Save the user OAuth profile
users.saveOAuthUserProfile(req, providerUserProfile, done);
}
));
};
// // Save the user OAuth profile
// users.saveOAuthUserProfile(req, providerUserProfile, done);
// }
// ));
// };

View file

@ -67,6 +67,12 @@ module.exports = function(grunt) {
options: {
jshintrc: true
}
},
allTests: {
src: watchFiles.allTests,
options: {
jshintrc: true
}
}
},
csslint: {
@ -283,13 +289,14 @@ module.exports = function(grunt) {
grunt.registerTask('secure', ['env:secure', 'lint', 'html2js:main', 'concurrent:default']);
// Lint task(s).
grunt.registerTask('lint', ['newer:jshint', 'newer:csslint']);
grunt.registerTask('lint', ['jshint', 'csslint']);
grunt.registerTask('lint:tests', ['jshint:allTests']);
// Build task(s).
grunt.registerTask('build', ['lint', 'loadConfig', 'uglify', 'cssmin', 'ngAnnotate', 'html2js:main']);
// Test task.
grunt.registerTask('test', ['test:server', 'test:client']);
grunt.registerTask('test:server', ['html2js:main', 'env:test', 'mochaTest']);
grunt.registerTask('test:client', ['html2js:main', 'env:test', 'karma:unit']);
grunt.registerTask('test', ['lint:tests', 'test:server', 'test:client']);
grunt.registerTask('test:server', ['lint:tests', 'html2js:main', 'env:test', 'mochaTest']);
grunt.registerTask('test:client', ['lint:tests', 'html2js:main', 'env:test', 'karma:unit']);
};

View file

@ -88,6 +88,7 @@
"useragent": "~2.1.7"
},
"devDependencies": {
"coveralls": "^2.11.4",
"grunt-mocha-istanbul": "^3.0.1",
"grunt-mocha-test": "~0.12.1",
"istanbul": "^0.4.0",
@ -102,6 +103,7 @@
"karma-phantomjs-launcher": "~0.1.2",
"mailosaur": "^1.0.1",
"mocha": ">=1.20.0",
"mocha-lcov-reporter": "^1.0.0",
"node-mandrill": "^1.0.1",
"should": "~7.1.1",
"supertest": "~1.1.0",

View file

@ -49,7 +49,7 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$htt
};
$scope.uploadPDF = function(files) {
console.log(files)
// console.log(files);
if (files && files.length) {
var file = files[0];

View file

@ -102,7 +102,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
$scope.deleteField = function (field_index){
//Delete field from field map
var currFieldId = $scope.myform.form_fields[field_index]._id
var currFieldId = $scope.myform.form_fields[field_index]._id;
if($scope.myform.hasOwnProperty('plugins.oscarhost.baseUrl')) delete $scope.myform.plugins.oscarhost.settings.fieldMap[currFieldId];
//Delete field

View file

@ -25,7 +25,7 @@ angular.module('forms').service('TimeCounter', [
this.clockStarted = function(){
return !!this._startTime;
}
};
}
]);

View file

@ -1,3 +1,4 @@
'use strict';
(function() {
// Forms Controller Spec
@ -17,13 +18,13 @@
};
var pdfObj = {
fieldname:"file",
originalname:"test.pdf",
name:"1440112660375.pdf",
encoding:"7bit",
mimetype:"application/pdf",
path:"uploads/tmp/test@test.com/1440112660375.pdf",
extension:"pdf",
fieldname:'file',
originalname:'test.pdf',
name:'1440112660375.pdf',
encoding:'7bit',
mimetype:'application/pdf',
path:'uploads/tmp/test@test.com/1440112660375.pdf',
extension:'pdf',
size:56223,
truncated:false,
buffer:null
@ -81,7 +82,7 @@
tmp_scope.user = sampleUser;
//gotacha: Controller and link functions will execute.
el = angular.element('<configure-form-directive myform="myform" user="user"></configure-form-directive>');
el = angular.element('<configure-form-directive myform='myform' user='user'></configure-form-directive>');
$compile(el)(tmp_scope);
$rootScope.$digest();

View file

@ -18,13 +18,13 @@
};
var pdfObj = {
fieldname:"file",
originalname:"test.pdf",
name:"1440112660375.pdf",
encoding:"7bit",
mimetype:"application/pdf",
path:"uploads/tmp/test@test.com/1440112660375.pdf",
extension:"pdf",
fieldname:'file',
originalname:'test.pdf',
name:'1440112660375.pdf',
encoding:'7bit',
mimetype:'application/pdf',
path:'uploads/tmp/test@test.com/1440112660375.pdf',
extension:'pdf',
size:56223,
truncated:false,
buffer:null
@ -131,7 +131,7 @@
tmp_scope.user = sampleUser;
//gotacha: Controller and link functions will execute.
el = angular.element('<edit-submissions-form-directive myform="myform" user="user"></edit-submissions-form-directive>');
el = angular.element('<edit-submissions-form-directive myform='myform' user='user'></edit-submissions-form-directive>');
$compile(el)(tmp_scope);
$rootScope.$digest();

View file

@ -18,13 +18,13 @@
};
var pdfObj = {
fieldname:"file",
originalname:"test.pdf",
name:"1440112660375.pdf",
encoding:"7bit",
mimetype:"application/pdf",
path:"uploads/tmp/test@test.com/1440112660375.pdf",
extension:"pdf",
fieldname:'file',
originalname:'test.pdf',
name:'1440112660375.pdf',
encoding:'7bit',
mimetype:'application/pdf',
path:'uploads/tmp/test@test.com/1440112660375.pdf',
extension:'pdf',
size:56223,
truncated:false,
buffer:null
@ -82,7 +82,7 @@
tmp_scope.myform = _.cloneDeep(sampleForm);
//gotacha: Controller and link functions will execute.
el = angular.element('<edit-form-directive myform="myform"></edit-form-directive>');
el = angular.element('<edit-form-directive myform='myform'></edit-form-directive>');
$compile(el)(tmp_scope);
$rootScope.$digest();

View file

@ -1,30 +1,30 @@
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
angular.module('stateMock').service('$state', function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
throw Error('Expected transition to state: ' + expectedState + ' but transitioned to ' + stateName );
}
}else{
throw Error("No more transitions were expected! Tried to transition to "+ stateName );
throw Error('No more transitions were expected! Tried to transition to '+ stateName );
}
console.log("Mock transition to: " + stateName);
console.log('Mock transition to: ' + stateName);
var deferred = $q.defer();
var promise = deferred.promise;
deferred.resolve();
return promise;
}
};
this.go = this.transitionTo;
this.expectTransitionTo = function(stateName){
this.expectedTransitions.push(stateName);
}
};
this.ensureAllTransitionsHappened = function(){
if(this.expectedTransitions.length > 0){
throw Error("Not all transitions happened!");
throw Error('Not all transitions happened!');
}
}
};
});

View file

@ -7,9 +7,6 @@ var init = require('./config/init')(),
mongoose = require('mongoose'),
chalk = require('chalk');
require('events').EventEmitter.prototype._maxListeners = 100;
/**
* Main application entry file.
* Please note that the order of loading is important.