Prepare v0.1.0 release
This commit is contained in:
42
webui/tests/policy-ui.test.ts
Normal file
42
webui/tests/policy-ui.test.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { campaignMailSettingsPolicyState } from "../src/features/campaigns/policyUi";
|
||||
|
||||
function assert(condition: unknown, message: string): void {
|
||||
if (!condition) throw new Error(message);
|
||||
}
|
||||
|
||||
const blockedInline = campaignMailSettingsPolicyState({
|
||||
effectivePolicy: { allow_campaign_profiles: false },
|
||||
selectedProfileId: ""
|
||||
});
|
||||
|
||||
assert(blockedInline.campaignProfilesAllowed === false, "Blocked policy must not allow campaign-local settings.");
|
||||
assert(blockedInline.inlineMailSettingsBlocked === true, "Inline SMTP/IMAP must be blocked when no reusable profile is selected.");
|
||||
assert(blockedInline.inlineOptionDisabled === true, "Inline option must be disabled under a blocking policy.");
|
||||
assert(blockedInline.canSelectInlineSettings === false, "Blocked inline option must not be selectable.");
|
||||
|
||||
const blockedWithReusableProfile = campaignMailSettingsPolicyState({
|
||||
effectivePolicy: { allow_campaign_profiles: false },
|
||||
selectedProfileId: "tenant-profile"
|
||||
});
|
||||
|
||||
assert(blockedWithReusableProfile.inlineMailSettingsBlocked === false, "Reusable profiles must remain usable when campaign-local settings are blocked.");
|
||||
assert(blockedWithReusableProfile.inlineOptionDisabled === true, "Inline option remains disabled even while a reusable profile is selected.");
|
||||
|
||||
const allowedInline = campaignMailSettingsPolicyState({
|
||||
effectivePolicy: { allow_campaign_profiles: true },
|
||||
selectedProfileId: ""
|
||||
});
|
||||
|
||||
assert(allowedInline.campaignProfilesAllowed === true, "Allowed policy must allow campaign-local settings.");
|
||||
assert(allowedInline.inlineMailSettingsBlocked === false, "Inline SMTP/IMAP must be available when campaign-local settings are allowed.");
|
||||
assert(allowedInline.inlineOptionDisabled === false, "Inline option must be enabled under an allowing policy.");
|
||||
assert(allowedInline.canSelectInlineSettings === true, "Allowed inline option must be selectable.");
|
||||
|
||||
const lockedInline = campaignMailSettingsPolicyState({
|
||||
effectivePolicy: { allow_campaign_profiles: true },
|
||||
selectedProfileId: "",
|
||||
locked: true
|
||||
});
|
||||
|
||||
assert(lockedInline.inlineOptionDisabled === false, "Policy does not disable inline settings when the policy allows them.");
|
||||
assert(lockedInline.canSelectInlineSettings === false, "A locked version still must not allow selecting inline settings.");
|
||||
Reference in New Issue
Block a user