error msg fix
This commit is contained in:
@@ -20,6 +20,9 @@ correct password must not end up signed in here with no routes to reach.
|
||||
|
||||
const ROLES: ConsoleRole[] = ['nearle-admin', 'store-admin', 'store-manager'];
|
||||
|
||||
/** The role this console turns away, used by the wording tests below. */
|
||||
const REFUSED_ROLE: ConsoleRole = 'nearle-admin';
|
||||
|
||||
test('this build is the merchant console, with nothing to configure', () => {
|
||||
// A constant, not a build flag. The flag existed only while one codebase
|
||||
// served both consoles; a variable now would be a way to deploy this
|
||||
@@ -55,3 +58,17 @@ test('the refusal names the platform console rather than blaming the account', (
|
||||
test('the refused role is named in words a person uses', () => {
|
||||
assert.match(wrongConsoleMessage('nearle-admin'), /Nearle staff/);
|
||||
});
|
||||
|
||||
test('the refusal tells them what to do, not what a category of account does', () => {
|
||||
// "Store admin accounts sign in at…" is a true statement about accounts in
|
||||
// general. "That is a Store admin account" is about the one in the box in
|
||||
// front of them, and the second sentence is an instruction rather than a
|
||||
// description. Both consoles use this shape, because a person sees one of
|
||||
// them and the pair should not read as two different products.
|
||||
const message = wrongConsoleMessage(REFUSED_ROLE);
|
||||
|
||||
assert.match(message, /^That is a .+ account\. Sign in at .+\.$/);
|
||||
// Two sentences, not a paragraph. This is read by somebody who expected to be
|
||||
// inside the application by now.
|
||||
assert.ok(message.length < 90, `too long to read at a glance: ${message}`);
|
||||
});
|
||||
|
||||
@@ -46,9 +46,18 @@ const PLATFORM_HOST =
|
||||
* Names the host rather than linking to it. A live link from one sign-in screen
|
||||
* to another reads as a redirect that failed, and this is not a failure — it is
|
||||
* the right answer to the wrong door.
|
||||
*
|
||||
* Both consoles say this the same way — "That is a X account. Sign in at Y." —
|
||||
* because a person only ever sees one of them and the pair should not read as
|
||||
* two different products. The earlier versions did: one opened "This is the
|
||||
* Nearle platform console…", the other closed with "…not here."
|
||||
*
|
||||
* It addresses what they typed rather than describing a category of account.
|
||||
* "Store admin accounts sign in at…" is true of accounts in general; "That is a
|
||||
* Store admin account" is about the one in the box in front of them.
|
||||
*/
|
||||
export function wrongConsoleMessage(role: ConsoleRole): string {
|
||||
return `${roleWord(role)} accounts sign in at ${PLATFORM_HOST}, not here.`;
|
||||
return `That is a ${roleWord(role)} account. Sign in at ${PLATFORM_HOST}.`;
|
||||
}
|
||||
|
||||
function roleWord(role: ConsoleRole): string {
|
||||
|
||||
Reference in New Issue
Block a user