Refine reusable mail profile credential editing
This commit is contained in:
@@ -19,6 +19,9 @@ import {
|
||||
mailProfileEditTargetShowsProfileFields,
|
||||
mailProfileEditTargetShowsSettingsPanel,
|
||||
mailProfileEditTargetVisibleSections,
|
||||
mailProfileCreateStageCanContinue,
|
||||
mailProfileCreateStagePanel,
|
||||
mailProfileCreateStages,
|
||||
mailProfileCreateCredentialsPayload,
|
||||
mailProfileTargetedUpdatePayload
|
||||
} from "../src/features/mail/mailProfileEditorModel";
|
||||
@@ -48,6 +51,68 @@ assertEqual(mailProfileEditTargetShowsProfileFields({ kind: "profile" }), true);
|
||||
assertEqual(mailProfileEditTargetShowsProfileFields({ kind: "server", protocol: "smtp" }), false);
|
||||
assertEqual(mailProfileEditTargetShowsSettingsPanel({ kind: "profile" }), false);
|
||||
assertEqual(mailProfileEditTargetShowsSettingsPanel({ kind: "create" }), true);
|
||||
assertDeepEqual(
|
||||
mailProfileCreateStages,
|
||||
[
|
||||
"profile",
|
||||
"smtp_server",
|
||||
"smtp_credentials",
|
||||
"imap_server",
|
||||
"imap_credentials"
|
||||
],
|
||||
"profile creation keeps server and credential stages explicit"
|
||||
);
|
||||
assertDeepEqual(
|
||||
mailProfileCreateStagePanel("smtp_credentials"),
|
||||
{
|
||||
showProfileFields: false,
|
||||
showSettingsPanel: true,
|
||||
initialSection: "smtp",
|
||||
visibleSections: ["smtp"],
|
||||
panelMode: "credentials"
|
||||
}
|
||||
);
|
||||
assertDeepEqual(
|
||||
mailProfileCreateStagePanel("imap_server"),
|
||||
{
|
||||
showProfileFields: false,
|
||||
showSettingsPanel: true,
|
||||
initialSection: "imap",
|
||||
visibleSections: ["imap"],
|
||||
panelMode: "server"
|
||||
}
|
||||
);
|
||||
assertEqual(
|
||||
mailProfileCreateStageCanContinue("profile", {
|
||||
name: "",
|
||||
smtpHost: "",
|
||||
imapHost: "",
|
||||
imapUsername: "",
|
||||
imapPassword: ""
|
||||
}),
|
||||
false
|
||||
);
|
||||
assertEqual(
|
||||
mailProfileCreateStageCanContinue("smtp_server", {
|
||||
name: "Profile",
|
||||
smtpHost: "smtp.example.org",
|
||||
imapHost: "",
|
||||
imapUsername: "",
|
||||
imapPassword: ""
|
||||
}),
|
||||
true
|
||||
);
|
||||
assertEqual(
|
||||
mailProfileCreateStageCanContinue("imap_credentials", {
|
||||
name: "Profile",
|
||||
smtpHost: "smtp.example.org",
|
||||
imapHost: "",
|
||||
imapUsername: "imap-user",
|
||||
imapPassword: ""
|
||||
}),
|
||||
false,
|
||||
"IMAP credentials cannot be submitted without an IMAP server"
|
||||
);
|
||||
|
||||
const updateParts = {
|
||||
profile: { name: "Renamed" },
|
||||
|
||||
Reference in New Issue
Block a user