-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PROD-1403: Omit specific fields from system payload if empty (#4525)
Co-authored-by: Allison King <[email protected]>
- Loading branch information
1 parent
1f62e7c
commit 7e2b55e
Showing
3 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { describe, expect, it } from "@jest/globals"; | ||
|
||
import { transformFormValuesToSystem } from "~/features/system/form"; | ||
|
||
describe("transformFormValuesToSystem", () => { | ||
it("should omit joint controller into and administrating department if empty", () => { | ||
const formValues = { | ||
system_type: "", | ||
fides_key: "", | ||
tags: [], | ||
name: "new system", | ||
description: "", | ||
dataset_references: [], | ||
processes_personal_data: true, | ||
exempt_from_privacy_regulations: false, | ||
reason_for_exemption: "", | ||
uses_profiling: false, | ||
does_international_transfers: false, | ||
requires_data_protection_assessments: false, | ||
privacy_policy: "", | ||
legal_name: "", | ||
legal_address: "", | ||
administrating_department: "", | ||
responsibility: [], | ||
joint_controller_info: "", | ||
data_security_practices: "", | ||
privacy_declarations: [], | ||
data_stewards: "", | ||
dpo: "", | ||
uses_cookies: false, | ||
cookie_refresh: false, | ||
uses_non_cookie_access: false, | ||
legitimate_interest_disclosure_url: "", | ||
}; | ||
|
||
const payload = transformFormValuesToSystem(formValues); | ||
expect(payload).not.toHaveProperty("administrating_department"); | ||
expect(payload).not.toHaveProperty("joint_controller_info"); | ||
}); | ||
|
||
it("should keep joint controller into and administrating department if not empty", () => { | ||
const formValues = { | ||
system_type: "", | ||
fides_key: "", | ||
tags: [], | ||
name: "new system", | ||
description: "", | ||
dataset_references: [], | ||
processes_personal_data: true, | ||
exempt_from_privacy_regulations: false, | ||
reason_for_exemption: "", | ||
uses_profiling: false, | ||
does_international_transfers: false, | ||
requires_data_protection_assessments: false, | ||
privacy_policy: "", | ||
legal_name: "", | ||
legal_address: "", | ||
administrating_department: "not empty", | ||
responsibility: [], | ||
joint_controller_info: "not empty", | ||
data_security_practices: "", | ||
privacy_declarations: [], | ||
data_stewards: "", | ||
dpo: "", | ||
uses_cookies: false, | ||
cookie_refresh: false, | ||
uses_non_cookie_access: false, | ||
legitimate_interest_disclosure_url: "", | ||
}; | ||
|
||
const payload = transformFormValuesToSystem(formValues); | ||
expect(payload).toHaveProperty("administrating_department"); | ||
expect(payload).toHaveProperty("joint_controller_info"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters