Skip to content

Commit

Permalink
Merge branch 'feature-PRESIDECMS-2964_recording-where-a-formbuilder-f…
Browse files Browse the repository at this point in the history
…orm-has-been-submitted-from' into release-10.28.0
  • Loading branch information
teonator committed Dec 20, 2024
2 parents 5eee010 + 0d1992b commit 15daab3
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions tests/unit/api/formbuilder/FormBuilderServiceTest.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -875,16 +875,18 @@ component extends="testbox.system.BaseSpec"{

it( "should save submission data to a form builder submission object when validation passes", function(){
var service = getService();
var formId = CreateUUId();
var formId = CreateUUID();
var requestData = { some="data" };
var formSubmissionData = { some="data", tests=CreateUUId() };
var formSubmissionData = { some="data", tests=CreateUUID() };
var formConfiguration = QueryNew( 'use_captcha', "boolean", [ [ true ] ] );
var formItems = [ "just", "test", "data" ];
var validationResult = CreateEmptyMock( "preside.system.services.validation.ValidationResult" );
var userAgent = CreateUUId();
var userAgent = CreateUUID();
var ipAddress = "219.349.93.4";
var instanceId = "TEST" & CreateUUId();
var userid = CreateUUId();
var instanceId = "TEST" & CreateUUID();
var instanceSite = CreateUUID();
var instanceUrl = "/helloworld.html";
var userid = CreateUUID();

service.$( "renderResponsesForSaving", formSubmissionData );
service.$( "isV2Form", false );
Expand All @@ -905,18 +907,22 @@ component extends="testbox.system.BaseSpec"{
mockActionsService.$( "triggerSubmissionActions" );

expect( service.saveFormSubmission(
formId = formId
, requestData = requestData
, instanceId = instanceId
, ipAddress = ipAddress
, userAgent = userAgent
formId = formId
, requestData = requestData
, instanceId = instanceId
, instanceSite = instanceSite
, instanceUrl = instanceUrl
, ipAddress = ipAddress
, userAgent = userAgent
) ).toBe( validationResult );

expect( mockFormSubmissionDao.$callLog().insertData.len() ).toBe( 1 );
expect( mockFormSubmissionDao.$callLog().insertData[1] ).toBe( { data={
form = formId
, submitted_by = userId
, form_instance = instanceId
, form_site = instanceSite
, form_url = instanceUrl
, ip_address = ipAddress
, user_agent = userAgent
, submitted_data = SerializeJson( formSubmissionData )
Expand Down

0 comments on commit 15daab3

Please sign in to comment.