Skip to content

Commit

Permalink
test: test the case when the commiting fc has made changes but the pe…
Browse files Browse the repository at this point in the history
…nding has not
  • Loading branch information
mikevespi committed Nov 22, 2023
1 parent 8f6d517 commit 1644562
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion schema/test/unit/mutations/commit_form_change_internal_test.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
begin;

select plan(11);
select plan(13);

/** SETUP **/
truncate cif.form_change restart identity;
Expand Down Expand Up @@ -165,7 +165,33 @@ select results_eq (
);

-- Test when committing has made changes to the form but the pending has not
select cif.create_project_revision(1, 'Amendment'); -- id = 4
select cif.create_project_revision(1, 'General Revision'); -- id = 5
update cif.form_change set new_form_data='{
"projectName": "Correct only newer",
"summary": "Correct",
"fundingStreamRfpId": 1,
"projectStatusId": 1,
"proposalReference": "1235",
"operatorId": 1
}'::jsonb
where project_revision_id=5
and form_data_table_name='project';

select cif.commit_project_revision(5);

select is (
(select new_form_data->>'projectName' from cif.form_change where id = 6),
'Correct only newer',
'The pending form change should have the value from the committing form change'
);

select cif.commit_project_revision(4);
select is (
(select project_name from cif.project where id = 1),
'Correct only newer',
'The project table should have the updated proejct name, even after the pending amendment is committed'
);

select finish();

Expand Down

0 comments on commit 1644562

Please sign in to comment.