diff --git a/schema/test/unit/mutations/commit_form_change_internal_test.sql b/schema/test/unit/mutations/commit_form_change_internal_test.sql index ce82afce72..1bfb5e4d99 100644 --- a/schema/test/unit/mutations/commit_form_change_internal_test.sql +++ b/schema/test/unit/mutations/commit_form_change_internal_test.sql @@ -1,6 +1,6 @@ begin; -select plan(15); +select plan(18); /** SETUP **/ truncate cif.form_change restart identity; @@ -136,6 +136,13 @@ select is ( 'When both the committing and pending form changes have changed the same field, the value from the pending should persist' ); +select is ( + (select previous_form_change_id from cif.form_change where project_revision_id = 2 and form_data_table_name = 'project'), + 3::int, + 'When committing, the pending form change gets the committing form change as its previous form change' +); + + select is ( (select project_name from cif.project where id = 1), 'Incorrect', @@ -154,6 +161,18 @@ select is ( 'When the committing form change is creating a project contact, the contact also gets created in the pending revision' ); +select is ( + (select previous_form_change_id from cif.form_change where project_revision_id = 2 and form_data_table_name = 'project_contact'), + 4::int, + 'When committing has an operation of create, the pending form change gets the committing form change as its previous form change' +); + +select is ( + (select form_data_record_id from cif.form_change where project_revision_id = 2 and form_data_table_name = 'project_attachment'), + 1::int, + 'When committing has an operation of create, the form_data_record_id propogates to the pending form change' +); + select is ( (select count(*) from cif.form_change where project_revision_id = 2 and form_data_table_name = 'project_attachment'), 1::bigint,