-
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.
Merge branch 'main' into aking/2434/new-manual-add-design
- Loading branch information
Showing
191 changed files
with
3,595 additions
and
741 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
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
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
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,27 @@ | ||
import { Config } from "~/types/config"; | ||
import minimalJson from "~/config/examples/minimal.json"; | ||
import basicJson from "~/config/examples/basic.json"; | ||
import fullJson from "~/config/examples/full.json"; | ||
|
||
describe("The Config type", () => { | ||
/** | ||
* If this test is failing, it's because the Config type has been updated in a way that is not | ||
* backwards-compatible. To fix this, modify the type so that it is more permissive with what it | ||
* allows, for example by making a property optional. Then you must handle the old/new | ||
* compatibility at runtime with sensible defaults. | ||
* | ||
* DO NOT make this test pass by updating any example JSON files. Those files are real snapshots | ||
* of configurations the PC should support. | ||
* | ||
* Discussion: https://github.com/ethyca/fides/discussions/2392 | ||
*/ | ||
it("is backwards-compatible with old JSON files", () => { | ||
const minimalTyped: Config = minimalJson; | ||
const basicTyped: Config = basicJson; | ||
const fullTyped: Config = fullJson; | ||
|
||
expect(minimalTyped).toBeDefined(); | ||
expect(basicTyped).toBeDefined(); | ||
expect(fullTyped).toBeDefined(); | ||
}); | ||
}); |
41 changes: 41 additions & 0 deletions
41
clients/privacy-center/__tests__/config/validate-config.test.ts
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,41 @@ | ||
import { produce } from "immer"; | ||
|
||
import { configIsValid } from "~/scripts/validate-config"; | ||
import minimalJson from "~/config/examples/minimal.json"; | ||
import fullJson from "~/config/examples/full.json"; | ||
|
||
describe("configIsValid", () => { | ||
const testCases = [ | ||
{ | ||
name: "no consent options", | ||
config: minimalJson, | ||
expected: { | ||
isValid: true, | ||
}, | ||
}, | ||
{ | ||
name: "valid consent options", | ||
config: fullJson, | ||
expected: { | ||
isValid: true, | ||
}, | ||
}, | ||
{ | ||
name: "multiple executable consent options", | ||
config: produce(fullJson, (draftConfig) => { | ||
draftConfig.consent.consentOptions[0].executable = true; | ||
draftConfig.consent.consentOptions[1].executable = true; | ||
}), | ||
expected: { | ||
isValid: false, | ||
message: "Cannot have more than one consent option be executable", | ||
}, | ||
}, | ||
]; | ||
|
||
testCases.forEach((tc) => { | ||
test(tc.name, () => { | ||
expect(configIsValid(tc.config)).toMatchObject(tc.expected); | ||
}); | ||
}); | ||
}); |
File renamed without changes.
Oops, something went wrong.