-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1179 from adobe/optionalIdentityComponent
Update the privacy component so it can be excluded from a custom build
- Loading branch information
Showing
8 changed files
with
67 additions
and
60 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,17 @@ | ||
/* | ||
Copyright 2024 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
import { IN, OUT, PENDING } from "../../constants/consentStatus.js"; | ||
import { objectOf, enumOf } from "../../utils/validation/index.js"; | ||
|
||
export default objectOf({ | ||
defaultConsent: enumOf(IN, OUT, PENDING).default(IN), | ||
}); |
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
38 changes: 38 additions & 0 deletions
38
test/unit/specs/components/Privacy/configValidators.spec.js
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,38 @@ | ||
import configValidators from "../../../../../src/components/Privacy/configValidators.js"; | ||
|
||
describe("defaultConsent", () => { | ||
it("validates defaultConsent=undefined", () => { | ||
const config = configValidators({}); | ||
expect(config.defaultConsent).toEqual("in"); | ||
}); | ||
it("validates defaultConsent={}", () => { | ||
expect(() => { | ||
configValidators({ | ||
defaultConsent: {}, | ||
}); | ||
}).toThrowError(); | ||
}); | ||
it("validates defaultConsent='in'", () => { | ||
const config = configValidators({ | ||
defaultConsent: "in", | ||
}); | ||
expect(config.defaultConsent).toEqual("in"); | ||
}); | ||
it("validates defaultConsent='pending'", () => { | ||
const config = configValidators({ | ||
defaultConsent: "pending", | ||
}); | ||
expect(config.defaultConsent).toEqual("pending"); | ||
}); | ||
it("validates defaultConsent=123", () => { | ||
expect(() => { | ||
configValidators({ defaultConsent: 123 }); | ||
}).toThrowError(); | ||
}); | ||
it("validates defaultConsent='out'", () => { | ||
const config = configValidators({ | ||
defaultConsent: "out", | ||
}); | ||
expect(config.defaultConsent).toEqual("out"); | ||
}); | ||
}); |
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