got angular unit tests to pass

This commit is contained in:
David Baldwynn 2017-04-23 13:11:30 -07:00
parent d303eb7bdf
commit 0871c70788
No known key found for this signature in database
GPG key ID: 15D1C13202224A9B
9 changed files with 26 additions and 35 deletions

View file

@ -2,11 +2,11 @@
"name": "tellform",
"description": "Opensource alternative to TypeForm",
"version": "2.0.0",
"homepage": "https://github.com/whitef0x0/tellform",
"homepage": "https://github.com/whitef0x0/tellform",
"authors": [
"David Baldwynn <polydaic@gmail.com> (http://baldwynn.me)"
],
"license": "MIT",
"license": "MIT",
"private": true,
"appPath": "public/modules",
"dependencies": {
@ -26,14 +26,13 @@
"angular-bootstrap-colorpicker": "~3.0.19",
"angular-ui-router-tabs": "~1.7.0",
"angular-scroll": "^1.0.0",
"angular-sanitize": "^1.5.3",
"angular-sanitize": "1.4.14",
"v-button": "^1.1.1",
"angular-busy": "^4.1.3",
"angular-input-stars": "https://github.com/whitef0x0/angular-input-stars.git#master",
"angular-input-stars": "https://github.com/tellform/angular-input-stars.git#master",
"raven-js": "^3.0.4",
"tableExport.jquery.plugin": "^1.5.1",
"js-yaml": "^3.6.1",
"angular-ui-select": "https://github.com/whitef0x0/ui-select.git#compiled",
"angular-ui-select": "https://github.com/tellform/ui-select.git#compiled",
"angular-translate": "~2.11.0",
"ng-translate": "*",
"deep-diff": "^0.3.4",
@ -48,7 +47,8 @@
"angular-bootstrap": "^0.14.0",
"angular": "1.4.14",
"angular-ui-select": "compiled",
"jspdf": "~1.0.178"
"jspdf": "~1.0.178",
"angular-sanitize": "1.4.14"
},
"overrides": {
"BOWER-PACKAGE": {

View file

@ -329,7 +329,7 @@ module.exports = function(grunt) {
grunt.option('force', true);
// A Task for loading the configuration object
/*grunt.task.registerTask('loadConfig', 'Task that loads the config into a grunt option.', function() {
grunt.task.registerTask('loadConfig', 'Task that loads the config into a grunt option.', function() {
require('./config/init')();
var config = require('./config/config');
console.log(config);
@ -337,7 +337,7 @@ module.exports = function(grunt) {
grunt.config.set('applicationJavaScriptFiles', config.assets.js);
grunt.config.set('formApplicationJavaScriptFiles', config.assets.form_js);
grunt.config.set('applicationCSSFiles', config.assets.css);
});*/
});
// Code coverage tasks.
grunt.registerTask('coveralls', ['env:test','mocha_istanbul:coveralls']);

View file

@ -94,7 +94,7 @@
"socket.io-redis": "^1.0.0",
"swig": "~1.4.1",
"uuid-token-generator": "^0.5.0",
"wildcard-subdomains": "github:whitef0x0/wildcard-subdomains"
"wildcard-subdomains": "github:tellform/wildcard-subdomains"
},
"devDependencies": {
"all-contributors-cli": "^4.3.0",

View file

@ -1,10 +1,10 @@
'use strict';
// Init the application configuration module for AngularJS application
(function() {
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'NodeForm';
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'cgBusy', 'ngSanitize', 'vButton', 'ngResource', 'TellForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate'];
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'ngSanitize', 'vButton', 'ngResource', 'TellForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate'];
// Add a new vertical module
var registerModule = function(moduleName, dependencies) {

View file

@ -1,6 +1,6 @@
<header data-ng-include="'/static/modules/core/views/header.client.view.html'"></header>
<div class="container" cg-busy="{promise:updatePromise,templateUrl:'modules/forms/admin/views/directiveViews/cgBusy/update-form-message-TypeB.html',message:'Updating form...', backdrop:false, wrapperClass:'.busy-updating-wrapper'}"></div>
<div class="container"></div>
<section class="admin-form">

View file

@ -1,3 +0,0 @@
<div>
<div style="text-align:center;font-size:26px;position:absolute;top:100px;width:100%;text-shadow:1px 1px 2px white, -1px -1px 2px white,-4px 4px 4px white,-4px 4px 4px white">{{$message}}</div>
</div>

View file

@ -1,4 +0,0 @@
<!-- cgBusy Template -->
<div>
<div style="text-align: center; font-size: 20px;position: fixed; bottom: 0; right: 55px; background-color: gray; color: white; padding: 5px 15px 5px 10px; z-index: 10;">{{$message}}</div>
</div>

View file

@ -90,7 +90,7 @@
// The injector ignores leading and trailing underscores here (i.e. _$httpBackend_).
// This allows us to inject a service but then attach it to a variable
// with the same name as the service.
beforeEach(inject(function($controller, $rootScope, _$state_, _$location_, _$stateParams_, _$httpBackend_, CurrentForm) {
beforeEach(inject(function($controller, $rootScope, _$state_, _$httpBackend_, CurrentForm) {
// Set a new global scope
scope = $rootScope.$new();
@ -98,9 +98,7 @@
CurrentForm.setForm(sampleForm);
// Point global variables to injected services
$stateParams = _$stateParams_;
$httpBackend = _$httpBackend_;
$location = _$location_;
$state = _$state_;
$httpBackend.whenGET(/\.html$/).respond('');

View file

@ -22,12 +22,12 @@
var sampleForgotToken = 'c2e8f74455cdccc454dfef941ff315fa4f7b1f0a';
var sampleCredentials = {
username: sampleUser.username,
password: sampleUser.password,
password: sampleUser.password
};
var samplePasswordDetails = {
newPassword: sampleUser.password,
verifyPassword: sampleUser.password,
verifyPassword: sampleUser.password
};
// The $resource service augments the response object with methods for updating and deleting the resource.
@ -65,7 +65,7 @@
}));
it('User.login() should send a POST request to /auth/signin', function() {
//Set POST response
$httpBackend.expect('POST', '/auth/signin', sampleCredentials).respond(200, sampleUser);
@ -76,7 +76,7 @@
});
it('User.logout() should logout user with /auth/signout', function() {
//Set POST response
$httpBackend.expect('GET', '/auth/signout').respond(200);
@ -87,7 +87,7 @@
});
it('User.getCurrent() should fetch user from /users/me', function() {
//Set POST response
$httpBackend.expect('GET', '/users/me').respond(200, sampleUser);
@ -99,7 +99,7 @@
it('User.signup() should signup user with /auth/signup', function() {
//Set POST response
$httpBackend.expect('POST', '/auth/signup', sampleCredentials).respond(200);
@ -110,7 +110,7 @@
});
it('User.resendVerifyEmail() should send POST request to /auth/verify', function() {
//Set POST response
$httpBackend.expect('POST', '/auth/verify', {email: sampleUser.email}).respond(200);
@ -121,7 +121,7 @@
});
it('User.validateVerifyToken() should send GET request to /auth/verify/:token', function() {
//Set POST response
$httpBackend.expect('GET', '/auth/verify/'+sampleVerifyToken).respond(200);
@ -132,9 +132,9 @@
});
it('User.resetPassword() should send GET request to /auth/forgot/:token', function() {
//Set POST response
$httpBackend.expect('GET', '/auth/password/'+sampleForgotToken).respond(200);
$httpBackend.expect('POST', '/auth/reset/'+sampleForgotToken).respond(200);
//Run Service Logic to Test
User.resetPassword(samplePasswordDetails, sampleForgotToken);
@ -143,7 +143,7 @@
});
it('User.askForPasswordReset() should send POST request to /auth/forgot', function() {
//Set POST response
$httpBackend.expect('POST', '/auth/forgot', sampleCredentials).respond(200, sampleUser);
@ -155,4 +155,4 @@
});
}());
}());