// 'use strict'; // /** // * Module dependencies. // */ // var should = require('should'), // mongoose = require('mongoose'), // User = mongoose.model('User'), // Form = mongoose.model('Form'), // Field = mongoose.model('Field'), // _ = require('lodash'), // async = require('async'), // soap = require('soap'), // config = require('../../config/config'), // OscarSecurity = require('../../scripts/oscarhost/OscarSecurity'), // FormSubmission = mongoose.model('FormSubmission'); // var exampleDemo = { // address: '880-9650 Velit. St.', // city: '', // dateOfBirth: '10', // displayName: 'Test User', // email: 'polydaic@gmail.com', // firstName: 'Test User', // hin: '', // lastName: 'AddDemographic', // lastUpdateDate: '2014-10-01 00:00:00', // monthOfBirth: '05', // officialLanguage: 'English', // phone: '250-222-2222', // phone2: '', // postal: 'S4M 7T8', // province: 'BC', // sex: 'F', // sexDesc: 'Female', // sin: '', // spokenLanguage: 'English', // title: 'MS.', // yearOfBirth: '2015' // }; // var sampleFormFields = [ // {'fieldType':'textfield', 'title':'What\'s your first name', 'fieldValue': ''}, // {'fieldType':'textfield', 'title':'And your last name', 'fieldValue': ''}, // {'fieldType':'radio', 'title':'And your sex', 'fieldOptions': [{ 'option_id': 0, 'option_title': 'Male', 'option_value': 'M' }, { 'option_id': 1, 'option_title': 'Female', 'option_value': 'F' }], 'fieldValue': ''}, // {'fieldType':'date', 'title':'When were you born?', 'fieldValue': ''}, // {'fieldType':'number', 'title':'What\'s your phone #?', 'fieldValue': ''} // ]; // var sampleSubmission = [ // {'fieldType':'textfield', 'title':'What\'s your first name', 'fieldValue': 'David'}, // {'fieldType':'textfield', 'title':'And your last name', 'fieldValue': 'Baldwynn'}, // {'fieldType':'radio', 'title':'And your sex', 'fieldValue': 'M', 'fieldOptions': [{ 'option_id': 0, 'option_title': 'Male', 'option_value': 'M' }, { 'option_id': 1, 'option_title': 'Female', 'option_value': 'F' }]}, // {'fieldType':'date', 'title':'When were you born?', 'fieldValue': 'Tue Oct 06 2015 15:17:48 GMT-0700 (PDT)'}, // {'fieldType':'number', 'title':'What\'s your phone #?', 'fieldValue': '6043158008'} // ]; // /** // * Globals // */ // var user, myForm, mySubmission; // /** // * Unit tests // */ // describe('FormSubmission Model Unit Tests:', function() { // this.timeout(15000); // beforeEach(function(done) { // user = new User({ // firstName: 'Full', // lastName: 'Name', // displayName: 'Full Name', // email: 'test1@test.com'+Date.now(), // username: 'test1@test.com'+Date.now(), // password: 'password', // provider: 'local' // }); // user.save(function(err) { // if(err){ // console.log(err.errors); // done(err); // return; // } // myForm = new Form({ // title: 'Form Title1', // admin: user._id, // language: 'english', // form_fields: [ // {'fieldType':'textfield', 'title':'What\'s your first name', 'fieldValue': ''}, // {'fieldType':'textfield', 'title':'And your last name', 'fieldValue': ''}, // {'fieldType':'radio', 'title':'And your sex', 'fieldOptions': [{ 'option_id': 0, 'option_title': 'Male', 'option_value': 'M' }, { 'option_id': 1, 'option_title': 'Female', 'option_value': 'F' }], 'fieldValue': ''}, // {'fieldType':'date', 'title':'When were you born?', 'fieldValue': ''}, // {'fieldType':'number', 'title':'What\'s your phone #?', 'fieldValue': ''}, // ], // plugins: { // oscarhost: { // baseUrl: config.oscarhost.baseUrl, // settings: { // updateType: 'force_add', // }, // auth: config.oscarhost.auth, // } // } // }); // myForm.save(function(err, form){ // if(err){ // console.log(err.errors); // done(err); // return; // } // var submissionFields = _.clone(myForm.form_fields); // for(var z=0; z