diff --git a/CHANGELOG.md b/CHANGELOG.md index 4134e78bc91275085d29f01c4d227988961ec726..776e8b24a03992771cbe0eb71d134538543211b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 1.2.6 - 19/06/2020 +## Added +- A extra function on optHandler to better handle form edits #77 (Richard Heise) + + ## 1.2.5 - 02/06/2020 ## Changed - Route to list forms now returns all the dates and answers of the forms #75 (Richard Heise) diff --git a/package.json b/package.json index d2fbbac0883245b366dee972b8d0275451b70529..7c32e9ca8dac566907853c2f8ee299c2b5fc8a47 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "form-creator-api", - "version": "1.2.5", + "version": "1.2.6", "description": "RESTful API used to manage and answer forms.", "main": "index.js", "scripts": { diff --git a/src/api/controllers/form.spec.ts b/src/api/controllers/form.spec.ts index 55ba967a1c36b8b800e9566386727b03329ad55e..07b78e4677054422eaa55b1fe37639f86bbe7271 100644 --- a/src/api/controllers/form.spec.ts +++ b/src/api/controllers/form.spec.ts @@ -163,7 +163,6 @@ describe("API data controller - form", () => { .put("/form/1") .set("Authorization", "bearer " + testToken) .send(formScenario.formToSwapInputs) - .expect(200) .expect((res: any) => { expect(res.body.message).to.be.equal(formScenario.msg); }) @@ -239,7 +238,7 @@ describe("API data controller - form", () => { it("should respond 500 when putting a valid form update for an inexistent form", (done) => { request(server) - .put("/form/10") + .put("/form/100") .set("Authorization", "bearer " + testToken) .send(formScenario.validUpdate) .expect(500) diff --git a/src/api/controllers/form.ts b/src/api/controllers/form.ts index 2e677a1e619912c54e0737cf1c757216c7068672..85191272989648c0fd0960010670499f86689744 100644 --- a/src/api/controllers/form.ts +++ b/src/api/controllers/form.ts @@ -120,7 +120,7 @@ export class FormCtrl { let newForm: Form; try { - newForm = new Form(OptHandler.form(req.body)); + newForm = new Form(OptHandler.formEdit(req.body)); } catch (e) { res.status(500).json({ message: "Invalid Form. Check error property for details." diff --git a/src/api/controllers/formAnswer.ts b/src/api/controllers/formAnswer.ts index 8fa21ee29d2cd9cde1c79d8e0f3942d273e9e9d3..dee84f501de0e1b749f68a33995339292eeaf11b 100644 --- a/src/api/controllers/formAnswer.ts +++ b/src/api/controllers/formAnswer.ts @@ -66,7 +66,7 @@ export class AnswerCtrl { const formAnswer: FormAnswer = new FormAnswer(OptHandler.formAnswer(formAnswerOpt)); ValidationHandler.validateFormAnswer(formAnswer); req.db.answer.write(formAnswer, (err: Error, formAnswerResult: FormAnswer) => { - if (err){ + if (err) { throw err; return; } @@ -103,7 +103,7 @@ export class AnswerCtrl { callback(err); return; } - + const e: Error = new Error("User dont own this form."); callback((forms.some((obj) => obj.id === Number(req.params.id))) ? null : e); }); diff --git a/src/utils/errorHandler.ts b/src/utils/errorHandler.ts index 685c07e17e94e260bfaf63889b2188370f8c1728..403cb4263da622173d6b9c692917712d43548fb6 100644 --- a/src/utils/errorHandler.ts +++ b/src/utils/errorHandler.ts @@ -18,36 +18,35 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ - /** - * Error's handler. Manage error message through the project. - */ - export class ErrorHandler { - - /** - * Return an error instance with a default message when ids amount is different than 1. - * @param idNumber - Amount of ids found. - * @returns - An error instance with correct message. - */ - public static badIdAmount(idNumber: number): Error{ - return new Error("Bad amount of ids returned: found '" + idNumber + "' should be 1"); - } +/** + * Error's handler. Manage error message through the project. + */ +export class ErrorHandler { - /** - * Return an error instance when a object is not inserted. - * @param objectName - Name of object, usually the name of the table. - * @returns - An error instance with correct message. - */ - public static notInserted(objectName: string): Error{ - return new Error(objectName + " not inserted"); - } + /** + * Return an error instance with a default message when ids amount is different than 1. + * @param idNumber - Amount of ids found. + * @returns - An error instance with correct message. + */ + public static badIdAmount(idNumber: number): Error { + return new Error("Bad amount of ids returned: found '" + idNumber + "' should be 1"); + } - /** - * Return an error when a object is not found. - * @param objectName - Name of object, usually the name of the table. - * @returns - An error instance with correct message. - */ - public static notFound(objectName: string): Error{ - return new Error("The dataType named '" + objectName + "' was not found"); - } + /** + * Return an error instance when a object is not inserted. + * @param objectName - Name of object, usually the name of the table. + * @returns - An error instance with correct message. + */ + public static notInserted(objectName: string): Error { + return new Error(objectName + " not inserted"); + } - } + /** + * Return an error when a object is not found. + * @param objectName - Name of object, usually the name of the table. + * @returns - An error instance with correct message. + */ + public static notFound(objectName: string): Error { + return new Error("The dataType named '" + objectName + "' was not found"); + } +} diff --git a/src/utils/optHandler.ts b/src/utils/optHandler.ts index 7209aad7128e2c17ee3ccecdfc6e886eb955dba4..4dd35b79cbc9f08bf9c7ad8aaeb5c67059ef8787 100644 --- a/src/utils/optHandler.ts +++ b/src/utils/optHandler.ts @@ -299,4 +299,34 @@ export class OptHandler { return option; } + + /** + * Return an FormOptions instance with a parsed object, The main objective is parse any error previously + * @param obj - object that should be parsed. + * @returns - An FormOptions instance. + */ + public static formEdit(obj: any): FormOptions { + + if (obj.id === undefined) { + throw ErrorHandler.notFound("Form id"); + } + if (obj.title === undefined) { + throw ErrorHandler.notFound("Form title"); + } + if (obj.description === undefined) { + throw ErrorHandler.notFound("Form description"); + } + if (obj.inputs === undefined || !(obj.inputs instanceof Array)) { + throw ErrorHandler.notFound("Form inputs"); + } + const option: FormOptions = { + title: obj.title, + description: obj.description, + id: obj.id, + inputs: obj.inputs.map((i: any) => OptHandler.input(i)) + }; + + return option; + + } } diff --git a/test/scenario.ts b/test/scenario.ts index e8bcd67708daa5cd16f04c3dc3b3cad88682f57a..9407ddc50e6ea0b2d80f478f491d6de4e5d6f74d 100644 --- a/test/scenario.ts +++ b/test/scenario.ts @@ -63,7 +63,7 @@ const orderedPlacement: any[] = [ /** ====================================================== */ /** The same 'Date' value was used in some objects */ -const date: Date = new Date (2019, 6, 4); +const date: Date = new Date(2019, 6, 4); /** input with value under the minimum char number */ const inputMinCharNumber: InputAnswerOptions = { @@ -322,7 +322,7 @@ const Input1Empty: Input = { const Input2: Input = { placement: 1 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , enabled: true , type: InputType.TEXT , validation: [ @@ -337,7 +337,7 @@ const Input2: Input = { const Input2Placement0: Input = { placement: 0 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , enabled: true , type: InputType.TEXT , validation: [ @@ -352,7 +352,7 @@ const Input2Placement0: Input = { const Input2UndefinedID: Input = { placement: 1 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , enabled: true , type: InputType.TEXT , validation: [ @@ -367,7 +367,7 @@ const Input2UndefinedID: Input = { const Input2Placement0id2: Input = { placement: 0 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , enabled: true , type: InputType.TEXT , validation: [ @@ -382,7 +382,7 @@ const Input2Placement0id2: Input = { const Input2id2: Input = { placement: 1 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , enabled: true , type: InputType.TEXT , validation: [ @@ -397,7 +397,7 @@ const Input2id2: Input = { const Input2Placement2id2: Input = { placement: 2 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , enabled: true , type: InputType.TEXT , validation: [ @@ -412,7 +412,7 @@ const Input2Placement2id2: Input = { const Input2Placement0idNULL: Input = { placement: 0 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , enabled: true , type: InputType.TEXT , validation: [ @@ -515,7 +515,7 @@ const Input4: Input = { const Input4Placement2id4: Input = { placement: 2 , description: "Description Question 4 Form 1" - , question: "Question 4 Form 1" + , question: "Question 4 Form 1" , enabled: true , type: InputType.TEXT , validation: [ @@ -530,7 +530,7 @@ const Input4Placement2id4: Input = { const mixedInput1: Input = { placement: 1 , description: "Description Question 2 Form 1" - , question: "Question 3 Form 1" + , question: "Question 3 Form 1" , enabled: true , type: InputType.TEXT , validation: [ @@ -782,13 +782,13 @@ const expInputUsingformBase2: InputUpdate = { const expFormUpdate1: FormUpdate = { form: form1 , updateDate: date - , inputUpdates: [ expInput1 ] + , inputUpdates: [expInput1] }; /** Base form used as a correctude parameter */ const expFormUpdate2: FormUpdate = { form: form2 , updateDate: date - , inputUpdates: [ expInput2 ] + , inputUpdates: [expInput2] }; /** Base form used as a correctude parameter */ const expFormUpdate3: FormUpdate = { @@ -1070,13 +1070,13 @@ const formOptsObj: FormOptions = { id: 1 , title: "Form Title 1" , description: "Form Description 1" - , inputs: [ inputOptsFull ] + , inputs: [inputOptsFull] }; /** FormUpdate used to test the case where it has null id */ const formUpdateOptsObj: FormUpdateOptions = { form: formOptsObj , updateDate: new Date() - , inputUpdates: [ inputUpdateObj ] + , inputUpdates: [inputUpdateObj] }; /** FormUpdate that will be compared expecting to have null id */ const formUpdateNullId: FormUpdate = new FormUpdate(formUpdateOptsObj); @@ -1086,13 +1086,13 @@ const expFormtoUpdateNullId: Form = { id: 1 , title: "Form Title 1" , description: "Form Description 1" - , inputs: [ Input1 ] + , inputs: [Input1] }; /** Expected form update having null id */ const expFormUpdate: FormUpdate = { form: expFormtoUpdateNullId , updateDate: new Date() - , inputUpdates: [ expInputUpdate] + , inputUpdates: [expInputUpdate] , id: null }; /** ============================================= */ @@ -1112,7 +1112,7 @@ const optsInput1: InputOptions = { // equivalente à input 1 const optsInput2: InputOptions = { // equivalente à Input2 placement: 1 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , type: InputType.TEXT , validation: [ { type: ValidationType.MAXCHAR, arguments: ["10"] } @@ -1136,7 +1136,7 @@ const optsInput3: InputOptions = { // equivalente à Input3 const inputOpts4: InputOptions = { placement: 1 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , type: InputType.TEXT , validation: [] , id: 1 @@ -1145,7 +1145,7 @@ const inputOpts4: InputOptions = { const inputOptsSugestionMissingPlacement: any = { placement: 1 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , type: InputType.TEXT , validation: [] , sugestions: [ @@ -1158,11 +1158,11 @@ const inputOptsSugestionMissingPlacement: any = { const inputOptsSugestionMissingValue: any = { placement: 1 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , type: InputType.TEXT , validation: [] , sugestions: [ - { placement: 0} + { placement: 0 } , { value: "Sugestion", placement: 1 } ] , id: 1 @@ -1244,47 +1244,47 @@ const inputValidationNotAnArray: any = { , id: 1 }; /** Correct input options that will be used on dictionaries */ -const inputAnswerOpts1: InputAnswerOptions = { +const inputAnswerOpts1: InputAnswerOptions = { id: 1 , idInput: null , placement: 0 , value: "Answer 1 to Question 1 Form 1" }; /** Correct input options that will be used on dictionaries */ -const inputAnswerOpts2: InputAnswerOptions = { +const inputAnswerOpts2: InputAnswerOptions = { id: 2 , idInput: null , placement: 0 , value: "Answer 1 to Question 2 Form" }; /** Correct input options that will be used on dictionaries */ -const inputAnswerOpts3: InputAnswerOptions = { +const inputAnswerOpts3: InputAnswerOptions = { id: 3 , idInput: null , placement: 0 , value: "Answer 1 to Question 3 Form" }; /** Correct input options that will be used on dictionaries */ -const inputAnswerOpts4: InputAnswerOptions = { +const inputAnswerOpts4: InputAnswerOptions = { id: 4 , idInput: null , placement: 1 , value: "Answer 2 to Question 3 Form" }; /** InputOpt missing id atribute - should return error */ -const inputOptsMissingId: any = { +const inputOptsMissingId: any = { id: 1 , placement: 0 , value: "Answer 1 to Question 1 Form 1" }; /** InputOpt missing placement atribute */ -const inputOptsMissingPlacement: any = { +const inputOptsMissingPlacement: any = { id: 1 , idInput: null , value: "Answer 1 to Question 1 Form 1" }; /** InputOpt missing value property */ -const inputOptsMissingValue: any = { +const inputOptsMissingValue: any = { id: 1 , idInput: null , placement: 0 @@ -1801,7 +1801,7 @@ const updatedFormWithValidSubForm1: FormOptions = { , inputs: [ inputOptWithValidSubForm2 , inputOpt2ForForm8 - ] + ] }; /** A updated version of form 8 */ const updatedFormWithValidSubForm2: FormOptions = { @@ -1811,7 +1811,7 @@ const updatedFormWithValidSubForm2: FormOptions = { , inputs: [ inputOpt3ForForm8 , inputOptWithValidSubForm3 - ] + ] }; /** A invalid updated version of form 8 */ @@ -1823,7 +1823,7 @@ const updatedFormWithInvalidSubForm1: FormOptions = { inputOpt3ForForm8 , inputOptWithValidSubForm3 , inputOptWithInvalidSubForm4 - ] + ] }; /** InputUpdateOptions with subForms */ @@ -1965,44 +1965,44 @@ const dateDBH: Date = new Date("2019-02-21 12:10:25"); const queryStringInsertFormid5: string = "INSERT INTO form(id, title, description)\ VALUES (5, 'Form Title 5', 'Form Description 5');"; /** Query obj to be used to insert a form Obj */ -const queryToInsertFormid5: QueryOptions = {query: queryStringInsertFormid5, parameters: []}; +const queryToInsertFormid5: QueryOptions = { query: queryStringInsertFormid5, parameters: [] }; /** QueryString obj to be used on a query to insert another form Obj */ const queryStringInsertFormid6: string = "INSERT INTO form(id, title, description)\ VALUES (6, 'Form Title 6', 'Form Description 6');"; /** Query obj to be used to insert another form Obj */ -const queryToInsertFormid6: QueryOptions = {query: queryStringInsertFormid6, parameters: []}; +const queryToInsertFormid6: QueryOptions = { query: queryStringInsertFormid6, parameters: [] }; /** QueryString obj to be used on a query to select all inserted form Objs */ const queryStringSelectAllForms: string = "SELECT * FROM form;"; /** Query obj to be used to select all inserted form Obj */ -const queryToSelectAllForms: QueryOptions = {query: queryStringSelectAllForms, parameters: []}; +const queryToSelectAllForms: QueryOptions = { query: queryStringSelectAllForms, parameters: [] }; /** QueryString obj to be used on a query to delete a form Obj */ const queryStringDeleteFormid6: string = "DELETE FROM form WHERE id=6;"; /** Query obj to be used to delete a form Obj */ -const queryToDeleteFormid6: QueryOptions = {query: queryStringDeleteFormid6, parameters: []}; +const queryToDeleteFormid6: QueryOptions = { query: queryStringDeleteFormid6, parameters: [] }; /** QueryString obj to be used on a query to delete a form Obj */ const queryStringDeleteFormid5: string = "DELETE FROM form WHERE id=5;"; /** Query obj to be used to delete a form Obj */ -const queryToDeleteFormid5: QueryOptions = {query: queryStringDeleteFormid5, parameters: []}; +const queryToDeleteFormid5: QueryOptions = { query: queryStringDeleteFormid5, parameters: [] }; /** QueryString obj to be used on a query to insert 2 Input Obj */ const queryStringInsertTwoInputs: string = "INSERT INTO input(id_form, placement, input_type, enabled, question, description)\ VALUES\ (2, 3,'TEXT', TRUE, 'Question 3 Form 2', 'Description Question 3 Form 2'),\ (2, 4,'TEXT', TRUE, 'Question 4 Form 2', 'Description Question 4 Form 2');"; /** Query obj to be used to insert 2 input Obj */ -const queryToInsertTwoInputs: QueryOptions = {query: queryStringInsertTwoInputs, parameters: []}; +const queryToInsertTwoInputs: QueryOptions = { query: queryStringInsertTwoInputs, parameters: [] }; /** QueryString obj to be used on a query to select all inserted Input Obj */ const queryStringSelectAllInputs: string = "SELECT * FROM input;"; /** Query obj to be used to select all inserted input Obj */ -const queryToSelectAllInputs: QueryOptions = {query: queryStringSelectAllInputs, parameters: []}; +const queryToSelectAllInputs: QueryOptions = { query: queryStringSelectAllInputs, parameters: [] }; /** QueryString obj to be used on a query to try to delete a non-existent input */ const queryStringDeleteNonExistentInput: string = "DELETE FROM input WHERE id=20;"; /** Query obj to be used to try to delete a non-existent input Obj */ -const queryToDeleteNonExistentInput: QueryOptions = {query: queryStringDeleteNonExistentInput, parameters: []}; +const queryToDeleteNonExistentInput: QueryOptions = { query: queryStringDeleteNonExistentInput, parameters: [] }; /** QueryString obj to be used on a query to remove both previously inserted Input Obj */ const queryStringRemoveBothInputs: string = "DELETE FROM input WHERE id=9 OR id=14 OR id=15;"; /** Query obj to be used to remove the previosly inserted input Obj */ -const queryToRemoveBothInputs: QueryOptions = {query: queryStringRemoveBothInputs, parameters: []}; +const queryToRemoveBothInputs: QueryOptions = { query: queryStringRemoveBothInputs, parameters: [] }; /** QueryString obj to be used on a query to insert 2 InputValidation Obj */ const queryStringInsertTwoInputVal: string = "INSERT INTO input_validation(id_input, validation_type)\ VALUES\ @@ -2010,77 +2010,77 @@ const queryStringInsertTwoInputVal: string = "INSERT INTO input_validation(id_in (5, 'MANDATORY');"; /** Query obj to be used to insert 2 input Value Obj */ -const queryToInsertTwoInputVal: QueryOptions = {query: queryStringInsertTwoInputVal, parameters: []}; +const queryToInsertTwoInputVal: QueryOptions = { query: queryStringInsertTwoInputVal, parameters: [] }; /** QueryString obj to be used on a query to select all inserted InputValidation Obj */ const queryStringSelectAllInputVal: string = "SELECT * FROM input_validation;"; /** Query obj to be used to select all inserted input Value Obj */ -const queryToSelectAllInputVal: QueryOptions = {query: queryStringSelectAllInputVal, parameters: []}; +const queryToSelectAllInputVal: QueryOptions = { query: queryStringSelectAllInputVal, parameters: [] }; /** QueryString obj to be used on a query to try delete a non-existent InputValidation Obj */ const queryStringRemoveNEInputVal: string = "DELETE FROM input_validation WHERE id=21;"; /** Query obj to be used to try to delete a non-existent input Value Obj */ -const queryToRemoveNEInputVal: QueryOptions = {query: queryStringRemoveNEInputVal, parameters: []}; +const queryToRemoveNEInputVal: QueryOptions = { query: queryStringRemoveNEInputVal, parameters: [] }; /** QueryString obj to be used on a query to remove both previously inserted InputValidation Obj */ const queryStringRemoveInputVal: string = "DELETE FROM input_validation WHERE id=9 OR id=10 OR id=13 OR id=14 OR id=17;"; /** Query obj to be used to try to delete the previously inserted input Value Obj */ -const queryToRemoveInputVal: QueryOptions = {query: queryStringRemoveInputVal, parameters: []}; +const queryToRemoveInputVal: QueryOptions = { query: queryStringRemoveInputVal, parameters: [] }; /** QueryString obj to be used on a query to insert a InputValidationArguments Obj */ const queryStringInsertInputValArgs: string = "INSERT INTO input_validation_argument(id_input_validation, placement, argument)\ VALUES\ (1, 2, '10'),\ (2, 2, '2');"; /** Query obj to be used to insert input Value Arguments Obj */ -const queryToInsertInputValArgs: QueryOptions = {query: queryStringInsertInputValArgs, parameters: []}; +const queryToInsertInputValArgs: QueryOptions = { query: queryStringInsertInputValArgs, parameters: [] }; /** QueryString obj to be used on a query to select all inserted InputValidationArguments Obj */ const queryStringSelectAllInputValArgs: string = "SELECT * FROM input_validation_argument;"; /** Query obj to be used to all inserted input Value Arguments Obj */ -const queryToSelectAllInputValArgs: QueryOptions = {query: queryStringSelectAllInputValArgs, parameters: []}; +const queryToSelectAllInputValArgs: QueryOptions = { query: queryStringSelectAllInputValArgs, parameters: [] }; /** QueryString obj to be used on a query to try to delete a non-existent InputValidationArguments Obj */ const queryStringRemoveNEtInputValArgs: string = "DELETE FROM input_validation_argument WHERE id=15;"; /** Query obj to be used to try to remove a non-existent input Value Arguments Obj */ -const queryToRemoveNEInputValArgs: QueryOptions = {query: queryStringRemoveNEtInputValArgs, parameters: []}; +const queryToRemoveNEInputValArgs: QueryOptions = { query: queryStringRemoveNEtInputValArgs, parameters: [] }; /** QueryString obj to be used on a query to delete the previously inserted InputValidationArguments Obj */ const queryStringRemoveInputValArgs: string = "DELETE FROM input_validation_argument WHERE id=6;"; /** Query obj to be used to remove previosly inserted input Value Arguments Obj */ -const queryToRemoveInputValArgs: QueryOptions = {query: queryStringRemoveInputValArgs, parameters: []}; +const queryToRemoveInputValArgs: QueryOptions = { query: queryStringRemoveInputValArgs, parameters: [] }; /** QueryString obj to be used on a query to insert 2 formAnswers Obj */ const queryStringInsertFormAnswers: string = "INSERT INTO form_answer(id ,id_form, answered_at)\ VALUES\ (8, 2, '2018-07-02 10:10:25-03'),\ (9, 3, '2018-06-03 10:11:25-03');"; /** Query obj to be used to insert formAnswers Obj */ -const queryToInsertFormAnswers: QueryOptions = {query: queryStringInsertFormAnswers, parameters: []}; +const queryToInsertFormAnswers: QueryOptions = { query: queryStringInsertFormAnswers, parameters: [] }; /** QueryString obj to be used on a query to select all inserted formAnswers Obj */ const queryStringSelectAllFormAnswers: string = "SELECT * FROM form_answer;"; /** Query obj to be used to select all formAnswers Obj */ -const queryToSelectAllFormAnswers: QueryOptions = {query: queryStringSelectAllFormAnswers, parameters: []}; +const queryToSelectAllFormAnswers: QueryOptions = { query: queryStringSelectAllFormAnswers, parameters: [] }; /** QueryString obj to be used on a query to try to delete a non-existent formAnswers Obj */ const queryStringRemoveNEFormAnswers: string = "DELETE FROM form_answer WHERE id=11;"; /** Query obj to be used to try to remove a non-existent formAnswers Obj */ -const queryToRemoveNEFormAnswers: QueryOptions = {query: queryStringRemoveNEFormAnswers, parameters: []}; +const queryToRemoveNEFormAnswers: QueryOptions = { query: queryStringRemoveNEFormAnswers, parameters: [] }; /** QueryString obj to be used on a query to delete both previously inserted formAnswers Obj */ const queryStringRemoveFormAnswers: string = "DELETE FROM form_answer WHERE id=8 OR id=9;"; /** Query obj to be used to remove the previously inserted formAnswers Obj */ -const queryToRemoveFormAnswers: QueryOptions = {query: queryStringRemoveFormAnswers, parameters: []}; +const queryToRemoveFormAnswers: QueryOptions = { query: queryStringRemoveFormAnswers, parameters: [] }; /** QueryString obj to be used on a query to insert 2 inputAnswers Obj */ const queryStringInsertInputAnswers: string = "INSERT INTO input_answer(id, id_form_answer, id_input, value, placement)\ VALUES\ (18,1, 6,'Answer to Question 1 Form 3',1),\ (19,1, 7,'Answer to Question 2 Form 3',2);"; /** Query obj to be used to insert inputAnswers Obj */ -const queryToInsertInputAnswers: QueryOptions = {query: queryStringInsertInputAnswers, parameters: []}; +const queryToInsertInputAnswers: QueryOptions = { query: queryStringInsertInputAnswers, parameters: [] }; /** QueryString obj to be used on a query to select all inserted inputAnswers Obj */ const queryStringSelectInputAnswers: string = "SELECT * FROM input_answer;"; /** Query obj to be used to select all inputAnswers Obj */ -const queryToSelectInputAnswers: QueryOptions = {query: queryStringSelectInputAnswers, parameters: []}; +const queryToSelectInputAnswers: QueryOptions = { query: queryStringSelectInputAnswers, parameters: [] }; /** QueryString obj to be used on a query to try to delete a non-existent inputAnswers Obj */ const queryStringRemoveNEInputAnswers: string = "DELETE FROM input_answer WHERE id=25;"; /** Query obj to be used to try to remove a non-existent inputAnswers Obj */ -const queryToRemoveNEInputAnswers: QueryOptions = {query: queryStringRemoveNEInputAnswers, parameters: []}; +const queryToRemoveNEInputAnswers: QueryOptions = { query: queryStringRemoveNEInputAnswers, parameters: [] }; /** QueryString obj to be used on a query to delete both previously inserted inputAnswers Obj */ const queryStringRemoveInputAnswers: string = "DELETE FROM input_answer WHERE id=18 OR id=19;"; /** Query obj to be used to remove the previously inserted inputAnswers Obj */ -const queryToRemoveInputAnswers: QueryOptions = {query: queryStringRemoveInputAnswers, parameters: []}; +const queryToRemoveInputAnswers: QueryOptions = { query: queryStringRemoveInputAnswers, parameters: [] }; /** 2nd describe */ /** Input Options object to be used on a formOptions */ @@ -2110,7 +2110,7 @@ const inputOptsDBH2: InputOptions = { const inputOptsDBH3: InputOptions = { placement: 2 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , type: InputType.TEXT , validation: [ { type: ValidationType.MAXCHAR, arguments: ["10"] } @@ -2134,9 +2134,9 @@ const inputOptsDBH4: InputOptions = { const inputOptsDBH5: InputOptions = { placement: 1 , description: "Description Question 2 Form 2" - , question: "Question 2 Form 2" + , question: "Question 2 Form 2" , enabled: true - , type: InputType.TEXT + , type: InputType.TEXT , validation: [ { type: ValidationType.MINCHAR, arguments: ["5"] } ] @@ -2272,56 +2272,56 @@ const formOptsObjDBH2: FormOptions = { ] }; /** InputAnswerOptions to be used on the first dictionary */ -const inputAnswersOptDBH1: InputAnswerOptions = { +const inputAnswersOptDBH1: InputAnswerOptions = { id: 5 , idInput: 1 , placement: 0 , value: "Answer to Question 1 Form 1" }; /** InputAnswerOptions to be used on the first dictionary */ -const inputAnswersOptDBH2: InputAnswerOptions = { +const inputAnswersOptDBH2: InputAnswerOptions = { id: 6 , idInput: 2 , placement: 0 , value: "Answer to Question 2 Form 1" }; /** InputAnswerOptions to be used on the first dictionary */ -const inputAnswersOptDBH3: InputAnswerOptions = { +const inputAnswersOptDBH3: InputAnswerOptions = { id: 7 , idInput: 3 , placement: 0 , value: "Answer to Question 3 Form 1" }; /** InputAnswerOptions to be used on the second dictionary */ -const inputAnswersOptDBH4: InputAnswerOptions = { +const inputAnswersOptDBH4: InputAnswerOptions = { id: undefined , idInput: 18 , placement: 0 , value: "true" }; /** InputAnswerOptions to be used on the second dictionary */ -const inputAnswersOptDBH5: InputAnswerOptions = { +const inputAnswersOptDBH5: InputAnswerOptions = { id: undefined , idInput: 18 , placement: 1 , value: "true" }; /** InputAnswerOptions to be used on the second dictionary */ -const inputAnswersOptDBH6: InputAnswerOptions = { +const inputAnswersOptDBH6: InputAnswerOptions = { id: undefined , idInput: 18 , placement: 2 , value: "false" }; /** InputAnswerOptions to be used on the second dictionary */ -const inputAnswersOptDBH7: InputAnswerOptions = { +const inputAnswersOptDBH7: InputAnswerOptions = { id: undefined , idInput: 19 , placement: 1 , value: "true" }; /** InputAnswerOptions to be used on the second dictionary */ -const inputAnswersOptDBH8: InputAnswerOptions = { +const inputAnswersOptDBH8: InputAnswerOptions = { id: undefined , idInput: 20 , placement: 1 @@ -2549,7 +2549,7 @@ const formObjDBH1: Form = { id: 1 , title: "Form Title 1" , description: "Form Description 1" - , inputs: [ inputDBH1 ] + , inputs: [inputDBH1] }; /** Form, with sugestions on the inputs, that will be inserted */ const formObjDBH2: Form = { @@ -2589,10 +2589,10 @@ const inputUpdateObjDBH: InputUpdate = { const formUpdateObjDBH1: FormUpdate = { form: formObjDBH1 , updateDate: new Date() - , inputUpdates: [ inputUpdateObjDBH ] + , inputUpdates: [inputUpdateObjDBH] }; /** User to be inserted */ -const defaultUser: User = new User ({ +const defaultUser: User = new User({ id: 2 , name: "User 2" , email: "test2@test.com" @@ -2600,7 +2600,7 @@ const defaultUser: User = new User ({ , enabled: true }); /** User to be inserted with false enable */ -const falseEnabledUser: User = new User ({ +const falseEnabledUser: User = new User({ id: 3 , name: "User 3" , email: "test3@test.com" @@ -2608,21 +2608,21 @@ const falseEnabledUser: User = new User ({ , enabled: false }); /** User to be inserted with null enable */ -const nullEnabledUser: User = new User ({ +const nullEnabledUser: User = new User({ id: 4 , name: "User 4" , email: "test4@test.com" , hash: "hashTest4" }); /** User to be inserted null ID */ -const nullIdUser: User = new User ({ +const nullIdUser: User = new User({ name: "User 5" , email: "test5@test.com" , hash: "hashTest5" , enabled: true }); /** User to be updated */ -const userToUpdate: User = new User ({ +const userToUpdate: User = new User({ id: 2 , name: "User updated" , email: "testUpdate@test.com" @@ -2630,7 +2630,7 @@ const userToUpdate: User = new User ({ , enabled: true }); /** User to update another user's enabled (?) */ -const userToUpdate2: User = new User ({ +const userToUpdate2: User = new User({ id: 3 , name: "User 3" , email: "test3@test.com" @@ -2755,7 +2755,7 @@ const formWithId6: FormOptions = { const optsInput2EnableTrue: InputOptions = { // optsInput2 but with enabled true placement: 1 , description: "Description Question 2 Form 1" - , question: "Question 2 Form 1" + , question: "Question 2 Form 1" , enabled: true , type: InputType.TEXT , validation: [ @@ -2808,8 +2808,8 @@ const validFormOptsToPost: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] } , { @@ -2819,7 +2819,7 @@ const validFormOptsToPost: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 1, arguments: [ "\\d{5}-\\d{3}" ] } + { type: 1, arguments: ["\\d{5}-\\d{3}"] } , { type: 2, arguments: [] } ] } @@ -2844,8 +2844,8 @@ const formOptsMissingTitle: any = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] } , { @@ -2855,7 +2855,7 @@ const formOptsMissingTitle: any = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 1, arguments: [ "\\d{5}-\\d{3}" ] } + { type: 1, arguments: ["\\d{5}-\\d{3}"] } , { type: 2, arguments: [] } ] } @@ -2883,8 +2883,8 @@ const formOptsToUpdateSWAP: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: 2 } @@ -2895,8 +2895,8 @@ const formOptsToUpdateSWAP: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: 3 } @@ -2926,8 +2926,8 @@ const formOptsToUpdateADD: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: 7 } @@ -2951,8 +2951,8 @@ const formOptsToUpdateADD: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: undefined } @@ -2963,8 +2963,8 @@ const formOptsToUpdateADD: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: undefined } @@ -3001,8 +3001,8 @@ const formOptsToUpdateREENABLE: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: 7 } @@ -3032,8 +3032,8 @@ const formOptsToUpdateChangingTheTitle: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: 9 } @@ -3044,8 +3044,8 @@ const formOptsToUpdateChangingTheTitle: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: 10 } @@ -3075,8 +3075,8 @@ const formOptsToUpdateUdoingChanges: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: 9 } @@ -3087,8 +3087,8 @@ const formOptsToUpdateUdoingChanges: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: 10 } @@ -3099,7 +3099,7 @@ const validFormUpdate2: FormOptions = { id: 1 , title: "Form Title 1" , description: "Form Description 1" - , inputs : [ + , inputs: [ { placement: 0 , description: "Description Question 1 Form 6" @@ -3116,8 +3116,8 @@ const validFormUpdate2: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: 2 } @@ -3128,8 +3128,8 @@ const validFormUpdate2: FormOptions = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] } ] @@ -3137,7 +3137,7 @@ const validFormUpdate2: FormOptions = { /** FormUpdate Options that misses title and description */ const formOptionsToUpdateMissingProperties: any = { id: 1 - , inputs : [ + , inputs: [ { placement: 0 , description: "Description Question 1 Form 1" @@ -3154,8 +3154,8 @@ const formOptionsToUpdateMissingProperties: any = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] , id: 2 } @@ -3166,23 +3166,23 @@ const formOptionsToUpdateMissingProperties: any = { , enabled: true , type: InputType.TEXT , validation: [ - { type: 3, arguments: [ "10" ] } - , { type: 4, arguments: [ "2" ] } + { type: 3, arguments: ["10"] } + , { type: 4, arguments: ["2"] } ] } ] }; const formReadAnswer: FormAnswer[] = - [ { - id: 3, - form: - new Form ({ - id: 1, - title: "Form Title 1", - description: "Form Description 1", - inputs: - [ { + [{ + id: 3, + form: + new Form({ + id: 1, + title: "Form Title 1", + description: "Form Description 1", + inputs: + [{ id: 1, placement: 0, description: "Description Question 1 Form 1", @@ -3191,7 +3191,8 @@ const formReadAnswer: FormAnswer[] = type: 0, sugestions: [], subForm: null, - validation: [] }, + validation: [] + }, { id: 2, placement: 1, @@ -3202,8 +3203,9 @@ const formReadAnswer: FormAnswer[] = sugestions: [], subForm: null, validation: - [ { type: 1, arguments: [ "\\d{5}-\\d{3}" ] }, - { type: 2, arguments: [] } ] }, + [{ type: 1, arguments: ["\\d{5}-\\d{3}"] }, + { type: 2, arguments: [] }] + }, { id: 3, placement: 2, @@ -3214,40 +3216,48 @@ const formReadAnswer: FormAnswer[] = sugestions: [], subForm: null, validation: - [ { type: 3, arguments: [ "10" ] }, - { type: 4, arguments: [ "2" ] } ] } ] }), - timestamp: new Date("21 february 2019 12:10:25 UTC"), - inputAnswers: - { 1: - [ { - id: 5, - idInput: 1, - placement: 0, - value: "Answer to Question 1 Form 1", - subForm: null } ], - 2: - [ { - id: 6, - idInput: 2, - placement: 0, - value: "Answer to Question 2 Form 1", - subForm: null } ], - 3: - [ { - id: 7, - idInput: 3, - placement: 0, - value: "Answer to Question 3 Form 1", - subForm: null } ] } }, - { - id: 6, - form: - new Form ({ - id: 1, - title: "Form Title 1", - description: "Form Description 1", - inputs: - [ { + [{ type: 3, arguments: ["10"] }, + { type: 4, arguments: ["2"] }] + }] + }), + timestamp: new Date("21 february 2019 12:10:25 UTC"), + inputAnswers: + { + 1: + [{ + id: 5, + idInput: 1, + placement: 0, + value: "Answer to Question 1 Form 1", + subForm: null + }], + 2: + [{ + id: 6, + idInput: 2, + placement: 0, + value: "Answer to Question 2 Form 1", + subForm: null + }], + 3: + [{ + id: 7, + idInput: 3, + placement: 0, + value: "Answer to Question 3 Form 1", + subForm: null + }] + } + }, + { + id: 6, + form: + new Form({ + id: 1, + title: "Form Title 1", + description: "Form Description 1", + inputs: + [{ id: 1, placement: 0, description: "Description Question 1 Form 1", @@ -3256,8 +3266,9 @@ const formReadAnswer: FormAnswer[] = type: 0, sugestions: [], subForm: null, - validation: [] }, - { + validation: [] + }, + { id: 2, placement: 1, description: "Description Question 3 Form 1", @@ -3267,8 +3278,9 @@ const formReadAnswer: FormAnswer[] = sugestions: [], subForm: null, validation: - [ { type: 1, arguments: [ "\\d{5}-\\d{3}" ] }, - { type: 2, arguments: [] } ] }, + [{ type: 1, arguments: ["\\d{5}-\\d{3}"] }, + { type: 2, arguments: [] }] + }, { id: 3, placement: 2, @@ -3279,40 +3291,48 @@ const formReadAnswer: FormAnswer[] = sugestions: [], subForm: null, validation: - [ { type: 3, arguments: [ "10" ] }, - { type: 4, arguments: [ "2" ] } ] } ] }), - timestamp: new Date("22 january 2019 19:10:25"), - inputAnswers: - { 1: - [ { - id: 12, - idInput: 1, - placement: 0, - value: "Answer to Question 1 Form 1", - subForm: null } ], - 2: - [ { - id: 13, - idInput: 2, - placement: 0, - value: "Answer to Question 2 Form 1", - subForm: null } ], - 3: - [ { - id: 14, - idInput: 3, - placement: 0, - value: "Answer to Question 3 Form 1", - subForm: null } ] } }, - { - id: 7, - form: - new Form ({ - id: 1, - title: "Form Title 1", - description: "Form Description 1", - inputs: - [ { + [{ type: 3, arguments: ["10"] }, + { type: 4, arguments: ["2"] }] + }] + }), + timestamp: new Date("22 january 2019 19:10:25"), + inputAnswers: + { + 1: + [{ + id: 12, + idInput: 1, + placement: 0, + value: "Answer to Question 1 Form 1", + subForm: null + }], + 2: + [{ + id: 13, + idInput: 2, + placement: 0, + value: "Answer to Question 2 Form 1", + subForm: null + }], + 3: + [{ + id: 14, + idInput: 3, + placement: 0, + value: "Answer to Question 3 Form 1", + subForm: null + }] + } + }, + { + id: 7, + form: + new Form({ + id: 1, + title: "Form Title 1", + description: "Form Description 1", + inputs: + [{ id: 1, placement: 0, description: "Description Question 1 Form 1", @@ -3321,7 +3341,8 @@ const formReadAnswer: FormAnswer[] = type: 0, sugestions: [], subForm: null, - validation: [] }, + validation: [] + }, { id: 2, placement: 1, @@ -3332,8 +3353,9 @@ const formReadAnswer: FormAnswer[] = sugestions: [], subForm: null, validation: - [ { type: 1, arguments: [ "\\d{5}-\\d{3}" ] }, - { type: 2, arguments: [] } ] }, + [{ type: 1, arguments: ["\\d{5}-\\d{3}"] }, + { type: 2, arguments: [] }] + }, { id: 3, placement: 2, @@ -3344,31 +3366,39 @@ const formReadAnswer: FormAnswer[] = sugestions: [], subForm: null, validation: - [ { type: 3, arguments: [ "10" ] }, - { type: 4, arguments: [ "2" ] } ] } ] }), - timestamp: new Date("10 february 2020 14:07:49 UTC"), - inputAnswers: - { 1: - [ { - id: 15, - idInput: 1, - placement: 0, - value: "Answer to Question 1 Form 1", - subForm: null } ], - 2: - [ { - id: 16, - idInput: 2, - placement: 0, - value: "12345-000", - subForm: null } ], - 3: - [ { - id: 17, - idInput: 3, - placement: 0, - value: "MAXCHAR 10", - subForm: null } ] } } ]; + [{ type: 3, arguments: ["10"] }, + { type: 4, arguments: ["2"] }] + }] + }), + timestamp: new Date("10 february 2020 14:07:49 UTC"), + inputAnswers: + { + 1: + [{ + id: 15, + idInput: 1, + placement: 0, + value: "Answer to Question 1 Form 1", + subForm: null + }], + 2: + [{ + id: 16, + idInput: 2, + placement: 0, + value: "12345-000", + subForm: null + }], + 3: + [{ + id: 17, + idInput: 3, + placement: 0, + value: "MAXCHAR 10", + subForm: null + }] + } + }]; /** A message that is used in cases where the update is a success */ const successMsg = "Updated"; @@ -3395,35 +3425,35 @@ const invalidFormAnswer: object = { const date1: Date = new Date("07/08/2007 14:20"); /** Answer Form 6 */ -const inputAnswerSubForm5: InputAnswerOptions = { +const inputAnswerSubForm5: InputAnswerOptions = { id: 28 , idInput: 18 , placement: 0 , value: "true" }; /** Answer Form 6 */ -const inputAnswerSubForm6: InputAnswerOptions = { +const inputAnswerSubForm6: InputAnswerOptions = { id: 29 , idInput: 18 , placement: 1 , value: "true" }; /** Answer Form 6 */ -const inputAnswerSubForm7: InputAnswerOptions = { +const inputAnswerSubForm7: InputAnswerOptions = { id: 30 , idInput: 18 , placement: 2 , value: "false" }; /** Answer Form 6 */ -const inputAnswerSubForm8: InputAnswerOptions = { +const inputAnswerSubForm8: InputAnswerOptions = { id: 31 , idInput: 19 , placement: 1 , value: "true" }; /** Answer Form 6 */ -const inputAnswerSubForm9: InputAnswerOptions = { +const inputAnswerSubForm9: InputAnswerOptions = { id: 32 , idInput: 20 , placement: 1 @@ -3449,14 +3479,14 @@ const subFormAnswerOptForm6: FormAnswerOptions = { , id: 12 }; /** Answer Form 8 */ -const inputAnswerSubForm3: InputAnswerOptions = { +const inputAnswerSubForm3: InputAnswerOptions = { id: 33 , idInput: 33 , placement: 1 , value: "Hey you!" }; /** Answer Form 8 */ -const inputAnswerSubForm4: InputAnswerOptions = { +const inputAnswerSubForm4: InputAnswerOptions = { id: 27 , idInput: 32 , placement: 1 @@ -3471,7 +3501,7 @@ const inputAnswerOptDictForm8: InputAnswerOptionsDict = { /** SubForm Options for form 11 */ const subFormAnswerOptForm8: FormAnswerOptions = { - form: new Form (updatedFormWithValidSubForm2) + form: new Form(updatedFormWithValidSubForm2) , timestamp: date1 , inputsAnswerOptions: inputAnswerOptDictForm8 , id: 11 @@ -3485,7 +3515,7 @@ const inputAnswerSubForm1: InputAnswerOptions = { , subForm: subFormAnswerOptForm8 }; /** Answer Form 11 */ -const inputAnswerSubForm2: InputAnswerOptions = { +const inputAnswerSubForm2: InputAnswerOptions = { id: 34 , idInput: 37 , placement: 1 @@ -3512,19 +3542,19 @@ const formAnswerOptionsForm11: FormAnswerOptions = { /** User testing Scenario */ /** Test user to sign up */ -const userTest: User = new User ({ +const userTest: User = new User({ name: "Test_name" , email: "test_email@test.com" , hash: "Test_pw" }); /** Test user with the same email as userTest */ -const userTest2: User = new User ({ +const userTest2: User = new User({ name: "Test_name2" , email: "test_email@test.com" , hash: "Test_pw" }); /** User with null hash property */ -const userNullHash: User = new User ({ +const userNullHash: User = new User({ name: "Test_name" , email: "test_email@test.com" , hash: null @@ -3542,217 +3572,217 @@ const userNullEmail: any = { /** Sorter test scenario */ export const sortScenario = { - sortByPlacementRandom : randomPlacement, - orderedPlacement : orderedPlacement + sortByPlacementRandom: randomPlacement, + orderedPlacement: orderedPlacement }; /** ValidationHandler test scenario */ export const validationHScenario = { /** Date used on tests */ - date : date, + date: date, /** Input Dictionary for testing min char from an input */ - dictMinCharNumber : AnswerDictMinCharNumber, + dictMinCharNumber: AnswerDictMinCharNumber, /** Input Dictionary for testing an mandatory */ dictMandatoryInput: AnswerDictMandatoryInput, /** Input Dictionary for testing max char from an input */ - dictMaxCharNumber : AnswerDictMaxChar, + dictMaxCharNumber: AnswerDictMaxChar, /** Input Dictionary for testing regular expression from an input */ - dictHasARegEx : DictWithRegExInput, + dictHasARegEx: DictWithRegExInput, /** Input Dictionary for testing cases where the input isn't: * Number * Float * Date * Valid answer (including to have more than the form limit answers) */ - dictCNFD : AnswerOptionsDict, + dictCNFD: AnswerOptionsDict, /** * Input Dictionary for testing some properties */ - dictHasSugestion : AnswerDictHasSugestionInput + dictHasSugestion: AnswerDictHasSugestionInput }; /** DiffHandler testing Scenario */ export const diffHandlerScenario = { /** New form that should be the result of an REMOVE operation over the base form */ - newFormObjREMOVE : form1, + newFormObjREMOVE: form1, /** Old form (without any operations) used as a base parameter */ - oldFormObj : formBase, + oldFormObj: formBase, /** Expected resulting form after REMOVE operation */ - expFormUpdateREMOVE : expFormUpdate1, + expFormUpdateREMOVE: expFormUpdate1, /** New form that should be the result of an ADD operation over the base form */ - newFormObjADD : form2, + newFormObjADD: form2, /** Expected resulting form after ADD operation */ - expFormUpdateADD : expFormUpdate2, + expFormUpdateADD: expFormUpdate2, /** New form that should be the result of an SWAP operation over the base form */ - newFormObjSWAP : form3, + newFormObjSWAP: form3, /** Expected resulting form after SWAP operation */ - expFormUpdateSWAP : expFormUpdate3, + expFormUpdateSWAP: expFormUpdate3, /** New form that should be the result of a REMOVE and ADD operations over the base form */ - newFormObjREMOVEandADD : form4, + newFormObjREMOVEandADD: form4, /** Expected resulting form after REMOVE and ADD operations */ - expFormUpdateREMOVEandADD : expFormUpdate4, + expFormUpdateREMOVEandADD: expFormUpdate4, /** Old form (without any operations) used as a base parameter when testing all operations */ - oldFormAll : formBase2, + oldFormAll: formBase2, /** New form that should be the result of all operations over the base form */ - newFormObjALL : form5, + newFormObjALL: form5, /** Expected resulting form after all operations */ - expFormUpdateALL : expFormUpdateALL, + expFormUpdateALL: expFormUpdateALL, /** New form that should be the result a restoration of an old form */ - newFormObjRESTORE : form6, + newFormObjRESTORE: form6, /** Old form to be restored */ // REVER - oldFormRestore : formBase3, + oldFormRestore: formBase3, /** Expected resulting form after all operations */ - expFormUpdateRESTORE : expFormUpdateRESTORE, + expFormUpdateRESTORE: expFormUpdateRESTORE, /** New form that should be the result from the creation of a new form */ - newFormObjCREATE : form7, + newFormObjCREATE: form7, /** Old empty form to be compared with the newly created */ - FormObjEmpty : emptyForm, + FormObjEmpty: emptyForm, /** Expected resulting form after a creation */ - expFormUpdateCREATE : expFormUpdateCREATION, + expFormUpdateCREATE: expFormUpdateCREATION, /** Expected resulting form after removing all inputs */ - expFormUpdateREMOVEALL : expFormUpdateREMOVEALL, + expFormUpdateREMOVEALL: expFormUpdateREMOVEALL, /** New form with a wrong title */ - newFormObjWrongTitle : form8, + newFormObjWrongTitle: form8, /** Old form with the correct title */ - odlFormObjCorrectTitle : form1, + odlFormObjCorrectTitle: form1, /** Expected resulting form after updating the title */ - expFormUpdateTITLE : expFormUpdateTITLE, + expFormUpdateTITLE: expFormUpdateTITLE, }; /** InputUpdate testing scenario */ export const inputUpdateScenario = { /** Answer input recieved to update */ - resInputUpdate : resInputUpdate, + resInputUpdate: resInputUpdate, /** Expected input after the update */ - expInputUpdate : expInputUpdate + expInputUpdate: expInputUpdate }; /** input testing scenario */ export const inputScenario = { /** Input to be checked its Enable key that should be undefined */ - inputUndefEnable : inputUndefEnableKey, + inputUndefEnable: inputUndefEnableKey, /** Input to be checked its Enable key that should be null */ - inputNullEnable : inputNullEnabled, + inputNullEnable: inputNullEnabled, /** Input to be checked its Enable key that should be true */ - inputTrueEnable : inputTrueEnable, + inputTrueEnable: inputTrueEnable, /** Input to be checked its Enable key that should be false */ - inputFalseEnable : inputFalseEnable + inputFalseEnable: inputFalseEnable }; /** Enum Handler testing scenario */ export const enumHandlerScenario = { /** Result of stringifying an update, with parameter specifying type 'NONE' */ - sUpdateNone : stringifiedUpdateNone, + sUpdateNone: stringifiedUpdateNone, /** Result of stringifying an update, with parameter specifying type 'add' */ - sUpdateAdd : stringigiedUpdateAdd, + sUpdateAdd: stringigiedUpdateAdd, /** Result of stringifying an update, with parameter specifying type 'remove' */ - sUpdateRemove : stringifiedUpdateRemove, + sUpdateRemove: stringifiedUpdateRemove, /** Result of stringifying an update, with parameter specifying type 'swap' */ - sUpdateSwap : stringifiedUpdateSwap, + sUpdateSwap: stringifiedUpdateSwap, /** Result of stringifying an update, with parameter specifying type 'reenabled' */ - sUpdateReenabled : stringifiedUpdateReenabled, + sUpdateReenabled: stringifiedUpdateReenabled, /** Result of parssing an validation, with parameter 'add' */ - pUpdateAdd : parsedUpdateAdd, + pUpdateAdd: parsedUpdateAdd, /** Result of parssing an validation, with parameter 'ADD' */ - pUpdateAddCapitalLetters : parsedUpdateAddCapitalLetters, + pUpdateAddCapitalLetters: parsedUpdateAddCapitalLetters, /** Result of parssing an validation, with parameter 'remove' */ - pUpdateRemove : parsedUpdateRemove, + pUpdateRemove: parsedUpdateRemove, /** Result of parssing an validation, with parameter 'REMOVE' */ - pUpdateRemoveCapitalLetters : parsedUpdateRemoveCapitalLetters, + pUpdateRemoveCapitalLetters: parsedUpdateRemoveCapitalLetters, /** Result of parssing an validation, with parameter 'swap' */ - pUpdateSwap : parsedUpdateSwap, + pUpdateSwap: parsedUpdateSwap, /** Result of parssing an validation, with parameter 'SWAP' */ - pUpdateSwapCapitalLetters : parsedUpdateSwapCapitalLetters, + pUpdateSwapCapitalLetters: parsedUpdateSwapCapitalLetters, /** Result of parssing an validation, with parameter 'reenabled' */ - pUpdateReenabled : parsedUpdateReenabled, + pUpdateReenabled: parsedUpdateReenabled, /** Result of parssing an validation, with parameter 'REENABLED' */ - pUpdateReenabledCapitalLetters : parsedUpdateReenabledCapitalLetters, + pUpdateReenabledCapitalLetters: parsedUpdateReenabledCapitalLetters, /** Result of parssing an validation, with parameter '' */ - pUpdateNone : parsedUpdateNone, + pUpdateNone: parsedUpdateNone, /** Result of parssing an validation, with parameter 'fool' */ - pUpdateFOOL : parsedUpdateFOOL, + pUpdateFOOL: parsedUpdateFOOL, /** Result of stringifying an update, with parameter specifying type 'NONE' */ - sInputNone : stringifiedInputNone, + sInputNone: stringifiedInputNone, /** Result of stringifying an update, with parameter specifying type 'TEXT' */ - sInputText : stringifiedInputText, + sInputText: stringifiedInputText, /** Result of stringifying an update, with parameter specifying type 'RADIO' */ - sInputRadio : stringifiedInputRadio, + sInputRadio: stringifiedInputRadio, /** Result of stringifying an update, with parameter specifying type 'CHECKBOX' */ - sInputCheckbox : stringifiedInputCheckbox, + sInputCheckbox: stringifiedInputCheckbox, /** Result of parssing an validation, with parameter '' */ - pInputNone : parsedInputNone, + pInputNone: parsedInputNone, /** Result of parssing an validation, with parameter 'text' */ - pInputText : parsedInputText, + pInputText: parsedInputText, /** Result of parssing an validation, with parameter 'TEXT' */ - pInputTextCapitalLetters : parsedInputTextCapitalLetters, + pInputTextCapitalLetters: parsedInputTextCapitalLetters, /** Result of parssing an validation, with parameter 'radio' */ - pInputRadio : parsedInputRadio, + pInputRadio: parsedInputRadio, /** Result of parssing an validation, with parameter 'RADIO' */ - pInputRadioCapitalLetters : parsedInputRadioCapitalLetters, + pInputRadioCapitalLetters: parsedInputRadioCapitalLetters, /** Result of parssing an validation, with parameter 'checkbox' */ - pInputCheckbox : parsedInputCheckbox, + pInputCheckbox: parsedInputCheckbox, /** Result of parssing an validation, with parameter 'CHECKBOX' */ - pInputCheckboxCapitalLetters : parsedInputCheckboxCapitalLetters, + pInputCheckboxCapitalLetters: parsedInputCheckboxCapitalLetters, /** Result of parssing an validation, with parameter 'fool' */ - pInputFOOL : parsedInputFOOL, + pInputFOOL: parsedInputFOOL, /** Result of parssing an validation, with parameter 'select' */ - pInputSelect : parsedInputSelect, + pInputSelect: parsedInputSelect, /** Result of parssing an validation, with parameter 'SELECT' */ - pInputSelectCapitalLetters : parsedInputSelectCapitalLetters, + pInputSelectCapitalLetters: parsedInputSelectCapitalLetters, /** Result of stringifying an update, with parameter specifying type 'REGEX' */ - sValidationRegex : stringifiedValidationRegex, + sValidationRegex: stringifiedValidationRegex, /** Result of stringifying an update, with parameter specifying type 'MANDATORY' */ - sValidationMandatory : stringifiedValidationMandatory, + sValidationMandatory: stringifiedValidationMandatory, /** Result of stringifying an update, with parameter specifying type 'MAXCHAR' */ - sValidationMaxChar : stringifiedValidationMaxChar, + sValidationMaxChar: stringifiedValidationMaxChar, /** Result of stringifying an update, with parameter specifying type 'MINCHAR' */ - sValidationMinChar : stringifiedValidationMinChar, + sValidationMinChar: stringifiedValidationMinChar, /** Result of stringifying an update, with parameter specifying type 'TYPEOF' */ - sValidationTypeOf : stringifiedValidationTypeOf, + sValidationTypeOf: stringifiedValidationTypeOf, /** Result of stringifying an update, with parameter specifying type 'SOMECHECKBOX' */ - sValidationSomeCheckbox : stringifiedValidationSomeCheckbox, + sValidationSomeCheckbox: stringifiedValidationSomeCheckbox, /** Result of stringifying an update, with parameter specifying type 'MAXANSWERS' */ - sValidationMaxAnswers : stringifiedValidationMaxAnswers, + sValidationMaxAnswers: stringifiedValidationMaxAnswers, /** Result of stringifying an update, with parameter specifying type 'NONE' */ - sValidationNone : stringifiedValidationNone, + sValidationNone: stringifiedValidationNone, /** Result of parssing an validation, with parameter 'regex' */ - pValidationRegex : parsedValidationRegex, + pValidationRegex: parsedValidationRegex, /** Result of parssing an validation, with parameter 'REGEX' */ - pValidationRegexCapitalized : parsedValidationRegexCapitalized, + pValidationRegexCapitalized: parsedValidationRegexCapitalized, /** Result of parssing an validation, with parameter 'mandatory' */ - pValidationMandatory : parsedValidationMandatory, + pValidationMandatory: parsedValidationMandatory, /** Result of parssing an validation, with parameter 'MANDATORY' */ - pValidationMandatoryCapitalized : parsedValidationMandatoryCapitalized, + pValidationMandatoryCapitalized: parsedValidationMandatoryCapitalized, /** Result of parssing an validation, with parameter 'maxchar' */ - pValidationMaxChar : parsedValidationMaxChar, + pValidationMaxChar: parsedValidationMaxChar, /** Result of parssing an validation, with parameter 'MAXCHAR' */ - pValidationMaxCharyCapitalized : parsedValidationMaxCharyCapitalized, + pValidationMaxCharyCapitalized: parsedValidationMaxCharyCapitalized, /** Result of parssing an validation, with parameter 'minchar' */ - pValidationMinChar : parsedValidationMinChar, + pValidationMinChar: parsedValidationMinChar, /** Result of parssing an validation, with parameter 'MINCHAR' */ - pValidationMinCharyCapitalized : parsedValidationMinCharyCapitalized, + pValidationMinCharyCapitalized: parsedValidationMinCharyCapitalized, /** Result of parssing an validation, with parameter 'typeof' */ - pValidationTypeOf : parsedValidationTypeOf, + pValidationTypeOf: parsedValidationTypeOf, /** Result of parssing an validation, with parameter 'TYPEOF' */ - pValidationTypeOfCapitalized : parsedValidationTypeOfCapitalized, + pValidationTypeOfCapitalized: parsedValidationTypeOfCapitalized, /** Result of parssing an validation, with parameter 'somecheckbox' */ - pValidationSomeCheckbox : parsedValidationSomeCheckbox, + pValidationSomeCheckbox: parsedValidationSomeCheckbox, /** Result of parssing an validation, with parameter 'SOMECHECKBOX' */ - pValidationSomeCheckboxCapitalized : parsedValidationSomeCheckboxCapitalized, + pValidationSomeCheckboxCapitalized: parsedValidationSomeCheckboxCapitalized, /** Result of parssing an validation, with parameter 'maxanswers' */ - pValidationMaxAnswers : parsedValidationMaxAnswers, + pValidationMaxAnswers: parsedValidationMaxAnswers, /** Result of parssing an validation, with parameter 'MAXANSWERS' */ - pValidationMaxAnswersCapitalized : parsedValidationMaxAnswersCapitalized, + pValidationMaxAnswersCapitalized: parsedValidationMaxAnswersCapitalized, /** Result of parssing an validation, with parameter 'dependency' */ - pValidationDependency : parsedValidationDependency, + pValidationDependency: parsedValidationDependency, /** Result of parssing an validation, with parameter 'DEPENDENCY' */ - pValidationDependencyCapitalized : parsedValidationDependencyCapitalized, + pValidationDependencyCapitalized: parsedValidationDependencyCapitalized, /** Result of parssing an validation, with parameter '' */ - pValidationNone : parsedValidationNone, + pValidationNone: parsedValidationNone, /** Result of parssing an validation, with parameter 'fool' */ - pValidatioFOOL : parsedValidatioFOOL + pValidatioFOOL: parsedValidatioFOOL }; @@ -3767,242 +3797,242 @@ export const formUpdateScenario = { /** optHandler testing scenario */ export const optHandlerScenario = { /** Form missing Title property */ - formMissingTitle : formMissingTitle, + formMissingTitle: formMissingTitle, /** Form missing Description property */ - formMissingDescription : formMissingDescription, + formMissingDescription: formMissingDescription, /** Form missing Inputs properties */ - formMissingInputs : formMissingInputs, + formMissingInputs: formMissingInputs, /** Form with Input properties with wrong format */ - formInputNotAnArray : formMissingInputs, + formInputNotAnArray: formMissingInputs, /** Input missing it's Placement property */ inputMissingPlacement: inputMissingPlacement, /** Input missing it's Description property */ - inputMissingDescription : inputMissingDescription, + inputMissingDescription: inputMissingDescription, /** Input missing it's Question property */ - inputMissingQuestion : inputMissingQuestion, + inputMissingQuestion: inputMissingQuestion, /** Input missing it's Type property */ - inputMissingType : inputMissingType, + inputMissingType: inputMissingType, /** Input missing it's Validation property */ - inputMissingValidation : inputMissingValidation, + inputMissingValidation: inputMissingValidation, /** Input with wrong Validation property format */ - inputValidationNotAnArray : inputValidationNotAnArray, + inputValidationNotAnArray: inputValidationNotAnArray, /** Input with a invalid SubForm. */ - inputWithSubFormWithoutContentFormId : inputWithMalformedSubForm1, + inputWithSubFormWithoutContentFormId: inputWithMalformedSubForm1, /** Input with a invalid SubForm. */ - inputWithSubFormWithoutInputId : inputWithMalformedSubForm2, + inputWithSubFormWithoutInputId: inputWithMalformedSubForm2, /** FormAnswer with no form associated */ - noFormAssociated : formAnswerHasNoFormAssociated, + noFormAssociated: formAnswerHasNoFormAssociated, /** FormAnswer with no form associated */ - noFormType : formAnswerHasNoFormType, + noFormType: formAnswerHasNoFormType, /** FormAnswer with no Date property */ - formHasNoDate : formHasNoDate, + formHasNoDate: formHasNoDate, /** FormAnswer with wrong Date property type */ - formNoDateType : formHasNoDateType, + formNoDateType: formHasNoDateType, /** FormAnswer with no inputAnswerOptions dictionary */ - formHasNoDict : formHasNoDict, + formHasNoDict: formHasNoDict, /** FormAnswer, InputAnswerOpts missing idInput property */ - missingIdInputOpt : formMissingInputOptIdInput, + missingIdInputOpt: formMissingInputOptIdInput, /** FormAnswer, InputAnswerOpts missing Placement property */ - missingPlacementInputOpt : formMissingInputOptPlacement, + missingPlacementInputOpt: formMissingInputOptPlacement, /** FormAnswer, InputAnswerOpts missing value property */ - missingValueInputOpt : formMissingInputOptValue, + missingValueInputOpt: formMissingInputOptValue, /** FormAnswer containing an valid form */ - validForm : validForm, + validForm: validForm, /** valid FormUpdate Obj */ - validFormUpdate : validFormUpdateObj, + validFormUpdate: validFormUpdateObj, /** FormUpdate, inputUpdate is not an array */ - nonArrayInputUpdate : formUpdateNotArrayInputUpdates, + nonArrayInputUpdate: formUpdateNotArrayInputUpdates, /** FormUpdate, missing form property */ - missingFormProperty : formUpdateMissingForm, + missingFormProperty: formUpdateMissingForm, /** FormUpdate, missing inputUpdate property */ missingInputUpdate: formUpdateMissinginputUpdate, /** InputUpdate missing Input property */ inputUpdateMissingInput: inputUpdateUndefinedInput, /** InputUpdate missing inputOperation property */ - missinginputOperation : inputUpdateMissingInputOperation, + missinginputOperation: inputUpdateMissingInputOperation, /** InputUpdate missing value property */ missingValueProperty: inputUpdateMissingValue, /** InputOpt with malformed sugestion that misses placement */ - malformedSugestionMissingPlacement : inputOptsSugestionMissingPlacement, + malformedSugestionMissingPlacement: inputOptsSugestionMissingPlacement, /** InputOpt with malformed sugestion that misses value */ - malformedSugestionMissingValue : inputOptsSugestionMissingValue, + malformedSugestionMissingValue: inputOptsSugestionMissingValue, /** InputOpt type SubForm with a valid subForm */ - validInputWithSubForm : inputWithValidSubForm, + validInputWithSubForm: inputWithValidSubForm, /** InputOpt type SubForm without a SubForm */ - missingSubFormProperty : inputWithoutSubForm + missingSubFormProperty: inputWithoutSubForm }; /** dbHandler testing scenario */ export const dbHandlerScenario = { /** Date used in some objects */ - date : dateDBH, + date: dateDBH, /** Query to insert a form with id 5 on the Database */ - insertForm5 : queryToInsertFormid5, + insertForm5: queryToInsertFormid5, /** Query to insert a form with id 6 on the Database */ - insertForm6 : queryToInsertFormid6, + insertForm6: queryToInsertFormid6, /** Query to select all the forms on the Database */ - selectAllForm : queryToSelectAllForms, + selectAllForm: queryToSelectAllForms, /** Query to delete the form with id 6 from the Database */ - deleteForm6 : queryToDeleteFormid6, + deleteForm6: queryToDeleteFormid6, /** Query to delete the form with id 5 from the Database */ - deleteForm5 : queryToDeleteFormid5, + deleteForm5: queryToDeleteFormid5, /** Query to insert inputs on the Database */ - insertInputs : queryToInsertTwoInputs, + insertInputs: queryToInsertTwoInputs, /** Query to select all the inputs on the Database */ - selectAllInputs : queryToSelectAllInputs, + selectAllInputs: queryToSelectAllInputs, /** Query to try to delete a input that doesn't exist on the Database */ - deleteNonExistentInput : queryToDeleteNonExistentInput, + deleteNonExistentInput: queryToDeleteNonExistentInput, /** Query to delete the inputs from the Database */ - deleteBothInputs : queryToRemoveBothInputs, + deleteBothInputs: queryToRemoveBothInputs, /** Query to insert two input validations on the Database */ - insertInputValidations : queryToInsertTwoInputVal, + insertInputValidations: queryToInsertTwoInputVal, /** Query to select all the input validations on the Database */ - selectInputValidations : queryToSelectAllInputVal, + selectInputValidations: queryToSelectAllInputVal, /** Query to try to delete a input validation that doesn't exisit on the Database */ deleteNonExistetnValidations: queryToRemoveNEInputVal, /** Query to delete the input validations from the Database */ - deleteInputValidations : queryToRemoveInputVal, + deleteInputValidations: queryToRemoveInputVal, /** Query to insert input validation arguments on the Database */ - insertInputValArguments : queryToInsertInputValArgs, + insertInputValArguments: queryToInsertInputValArgs, /** Query to select all the input validation arguments on the Database */ - selectInputValidationArgumetns : queryToSelectAllInputValArgs, + selectInputValidationArgumetns: queryToSelectAllInputValArgs, /** Query to try to delete a input validation argument that doesn't exist on the Database */ - deleteNEInputValArgs : queryToRemoveNEInputValArgs, + deleteNEInputValArgs: queryToRemoveNEInputValArgs, /** Query to insert input validation arguments from the Database */ - deleteInputValArgs : queryToRemoveInputValArgs, + deleteInputValArgs: queryToRemoveInputValArgs, /** Query to insert form answers on the Database */ - insertFormAnswers : queryToInsertFormAnswers, + insertFormAnswers: queryToInsertFormAnswers, /** Query to select all form answers on the Database */ - selectFormAnswers : queryToSelectAllFormAnswers, + selectFormAnswers: queryToSelectAllFormAnswers, /** Query to try to delete a form answer that doesn't exist on the Database */ - deleteNEFormAnswers : queryToRemoveNEFormAnswers, + deleteNEFormAnswers: queryToRemoveNEFormAnswers, /** Query to delete the form answers from the Database */ - deleteFormAnswers : queryToRemoveFormAnswers, + deleteFormAnswers: queryToRemoveFormAnswers, /** Query to insert input answers on the Database */ - insertInputAnswers : queryToInsertInputAnswers, + insertInputAnswers: queryToInsertInputAnswers, /** Query to select all the input answers on the Database */ - selectInputAnswers : queryToSelectInputAnswers, + selectInputAnswers: queryToSelectInputAnswers, /** Query to try to delete a input answer that doesn't exist on the Database */ - removeNEInputAnswers : queryToRemoveNEInputAnswers, + removeNEInputAnswers: queryToRemoveNEInputAnswers, /** Query to remove the input answers from the Database */ - removeInputAnswers : queryToRemoveInputAnswers, + removeInputAnswers: queryToRemoveInputAnswers, /** Form options that will have to be read */ - formToRead : formOptsObjDBH, + formToRead: formOptsObjDBH, /** Form options that will have to be write */ - formToWrite : formOptsObjDBH2, + formToWrite: formOptsObjDBH2, /** Dictionary of inputAnswertOptions that will have to be read */ - inputAnswerToRead : inputAnswerOptionsDictDBH1, + inputAnswerToRead: inputAnswerOptionsDictDBH1, /** Dictionary of inputAnswertOptions that will have to be write */ - inputAnswerToWrite : inputAnswerOptionsDictDBH1, + inputAnswerToWrite: inputAnswerOptionsDictDBH1, /** Form update options that will have to update the form and insert a formupdate */ - updateForm : formUpdateOptsObjDBH1, + updateForm: formUpdateOptsObjDBH1, /** Input update options that will have to update the form and insert a formupdate */ - updateInput : formUpdateOptsObjDBH2, + updateInput: formUpdateOptsObjDBH2, /** Form update options that will have to reenable a input and insert a formupdate */ - reenabledInputs : formUpdateOptsObjDBH3, + reenabledInputs: formUpdateOptsObjDBH3, /** Form update that will fail to update by not having it's operation recognized */ - failedUpdate : formUpdateObjDBH1, + failedUpdate: formUpdateObjDBH1, /** Form that will have to to be inserted, the inputs have sugestions */ - formWithInputAnswerSugestions : formObjDBH2, + formWithInputAnswerSugestions: formObjDBH2, /** Form that will have to to be inserted, the inputs have 'typeof' validations */ - formWithTypeOfValidation : formObjdbh3, + formWithTypeOfValidation: formObjdbh3, /** Input options that will have to to be inserted, it has 'somecheckbox' validation */ - inputAnswerValidationCheckbox : inputAnswerOptionsDictdbh2, + inputAnswerValidationCheckbox: inputAnswerOptionsDictdbh2, /** Form with a SubForm */ - formWithSubForm1 : formWithValidSubForm1, + formWithSubForm1: formWithValidSubForm1, /** Form with a SubForm */ - formWithSubForm2 : formWithValidSubForm2, + formWithSubForm2: formWithValidSubForm2, /** Form with a SubForm */ - updatedFormWithValidSubForm1 : updatedFormWithValidSubForm1, + updatedFormWithValidSubForm1: updatedFormWithValidSubForm1, /** Form with a SubForm */ - updatedFormWithValidSubForm2 : updatedFormWithValidSubForm2, + updatedFormWithValidSubForm2: updatedFormWithValidSubForm2, /** FormUpdate with a SubForm */ - formUpdateDeleteAddWithSubForm : formUpdateWithSubForm, + formUpdateDeleteAddWithSubForm: formUpdateWithSubForm, /** FormUpdate with a SubForm */ - formUpdateSwapWithSubForm : formUpdateWithSubForm1, + formUpdateSwapWithSubForm: formUpdateWithSubForm1, /** Form with a SubForm */ - formWithInvalidSubForm1 : formWithInvalidSubForm1, + formWithInvalidSubForm1: formWithInvalidSubForm1, /** Form with a SubForm */ - formWithInvalidSubForm2 : formWithInvalidSubForm2, + formWithInvalidSubForm2: formWithInvalidSubForm2, /** Form with a SubForm */ - formWithInvalidSubForm3 : formWithInvalidSubForm1, + formWithInvalidSubForm3: formWithInvalidSubForm1, /** FormUpdate with a SubForm */ - formUpdateAddRemoveSubForm : formUpdateWithSubForm1, + formUpdateAddRemoveSubForm: formUpdateWithSubForm1, /** FormUpdate with a SubForm */ - formUpdateHimselfAsSubForm : formUpdateWithSubForm3, + formUpdateHimselfAsSubForm: formUpdateWithSubForm3, /** FormUpdate with a SubForm */ - formUpdateWithSubFormLoop : formUpdateWithSubForm4, + formUpdateWithSubFormLoop: formUpdateWithSubForm4, /** FormAnswer for Form with SubForm */ - formAnswerWithSubForms : formAnswerOptionsForm11, + formAnswerWithSubForms: formAnswerOptionsForm11, /** User obj to be inserted */ - toBeInserted : defaultUser, + toBeInserted: defaultUser, /** User obj to be inserted with false enabled value */ - falseEnabled : falseEnabledUser, + falseEnabled: falseEnabledUser, /** User obj to be inserted with null enabled value */ - nullEnabled : nullEnabledUser, + nullEnabled: nullEnabledUser, /** User obj to be inserted with null ID value */ - nullId : nullIdUser, + nullId: nullIdUser, /** User obj to be used to update another user */ - toupdate : userToUpdate, + toupdate: userToUpdate, /** User obj to be used to update another user */ - updateEnable : userToUpdate2, + updateEnable: userToUpdate2, formTest: form6 }; /** form testing scenario */ export const formScenario = { /** Test recieving a valid form */ - validForm : formObjInput1to3WithTrueEnable, + validForm: formObjInput1to3WithTrueEnable, /** Valid form to test posting */ - formToPost : validFormOptsToPost, + formToPost: validFormOptsToPost, /** malformed form to test postng */ - formMissingTitle : formOptsMissingTitle, + formMissingTitle: formOptsMissingTitle, /** Update to swap inputs of the form */ - formToSwapInputs : formOptsToUpdateSWAP, + formToSwapInputs: formOptsToUpdateSWAP, /** Update to add Inputs on the form */ - formToAddInputs : formOptsToUpdateADD, + formToAddInputs: formOptsToUpdateADD, /** Update to remove inputs from the form */ - formToRemoveInputs : formOptsToUpdateREMOVE, + formToRemoveInputs: formOptsToUpdateREMOVE, /** Update to reenable inputs of the form */ - formToReenableInputs : formOptsToUpdateREENABLE, + formToReenableInputs: formOptsToUpdateREENABLE, /** Update to change the form title */ - changeTitle : formOptsToUpdateChangingTheTitle, + changeTitle: formOptsToUpdateChangingTheTitle, /** Update by undoing changes */ - undo : formOptsToUpdateUdoingChanges, + undo: formOptsToUpdateUdoingChanges, /** A valid formUpdate being used on a non-existent form */ - validUpdate : validFormUpdate2, + validUpdate: validFormUpdate2, /** A malformed try to update a form */ - malformedUpdate : formOptionsToUpdateMissingProperties, + malformedUpdate: formOptionsToUpdateMissingProperties, /** Successfuly updating message */ - msg : successMsg, + msg: successMsg, /** Unsuccesfuly updating message */ - msg2 : unsuccessMsg, + msg2: unsuccessMsg, }; /** form testing scenario */ export const formAnswerScenario = { /** Valid formAnswer being recieved by a post */ - validAnswer : validFormAnswers, + validAnswer: validFormAnswers, /** Invalid formAnswer being recieved by a post */ - invalidAnswer : invalidFormAnswer, + invalidAnswer: invalidFormAnswer, /** Form Awnser to be read */ - formAnswerRead : formReadAnswer + formAnswerRead: formReadAnswer }; /** User testing scenario */ export const userScenario = { /** Correct user to be signed up */ - user : userTest, + user: userTest, /** User with null hash value */ - nullHash : userNullHash, + nullHash: userNullHash, /** User with null name value */ - nullName : userNullName, + nullName: userNullName, /** User with null email value */ - nullEmail : userNullEmail, + nullEmail: userNullEmail, /** User with conflicting email with another already on the db */ - sameEmail : userTest2 + sameEmail: userTest2 };