diff --git a/src/auth/workspace.test.ts b/src/auth/workspace.test.ts index cdfd514..2441da2 100644 --- a/src/auth/workspace.test.ts +++ b/src/auth/workspace.test.ts @@ -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 = 'store-admin'; + test('this build is the platform console, with nothing to configure', () => { // A constant rather than a build flag. The merchant console reads one because // it once served both sites; here a variable would only create a way to @@ -57,3 +60,17 @@ test('each refused role is named in words a person uses', () => { assert.match(wrongConsoleMessage('store-admin'), /Store admin/); assert.match(wrongConsoleMessage('store-manager'), /Store user/); }); + +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}`); +}); diff --git a/src/auth/workspace.ts b/src/auth/workspace.ts index 8985178..c661645 100644 --- a/src/auth/workspace.ts +++ b/src/auth/workspace.ts @@ -49,9 +49,18 @@ const MERCHANT_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 `This is the Nearle platform console. ${roleWord(role)} accounts sign in at ${MERCHANT_HOST}.`; + return `That is a ${roleWord(role)} account. Sign in at ${MERCHANT_HOST}.`; } function roleWord(role: ConsoleRole): string {