Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

99461 The auth header adjusts capitalization so we should too #33780

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/applications/mhv-landing-page/mocks/api/user/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ const generateUser = ({
loa = 3,
mhvAccountState = 'OK',
vaPatient = true,
firstName = 'Gina',
preferredName = 'Ginny',
} = {}) => {
return {
...defaultUser,
Expand All @@ -90,6 +92,8 @@ const generateUser = ({
},
profile: {
...defaultUser.data.attributes.profile,
first_name: firstName,
preferred_Name: preferredName,
loa: { current: loa },
sign_in: {
service_name: serviceName,
Expand All @@ -108,6 +112,7 @@ const CSP_IDS = {
};

const USER_MOCKS = Object.freeze({
ALL_CAPS_NAME: generateUser({ firstName: 'KEVIN', preferredName: '' }),
UNREGISTERED: generateUser({ vaPatient: false }),
UNVERIFIED: generateUser({ loa: 1, vaPatient: false }),
LOGIN_GOV_UNVERIFIED: generateUser({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { startCase, toLower } from 'lodash';

export const selectGreetingName = state => {
return (
state?.user?.profile?.preferredName ||
state?.user?.profile?.userFullName?.first ||
startCase(toLower(state?.user?.profile?.userFullName?.first)) ||
null
);
};
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
import { appName } from '../../../manifest.json';
import ApiInitializer from '../utilities/ApiInitializer';
import LandingPage from '../pages/LandingPage';
import { USER_MOCKS } from '../../../mocks/api/user';

describe(`${appName} -- Welcome message`, () => {
beforeEach(() => {
ApiInitializer.initializeMessageData.withUnreadMessages();
});

it('personalization enabled', () => {
ApiInitializer.initializeFeatureToggle.withAllFeatures();
LandingPage.visit();
cy.findByRole('heading', { level: 2, name: /^Welcome/ }).should.exist;
cy.injectAxeThenAxeCheck();
context('personalization enabled', () => {
beforeEach(() => {
ApiInitializer.initializeFeatureToggle.withAllFeatures();
});

it('shows the Welcome', () => {
LandingPage.visit();
cy.findByRole('heading', { level: 2, name: /^Welcome/ }).should.exist;
cy.injectAxeThenAxeCheck();
});

it('should match name capitalization to auth header', () => {

Check warning on line 22 in src/applications/mhv-landing-page/tests/e2e/personalization/welcome-message.cypress.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv-landing-page/tests/e2e/personalization/welcome-message.cypress.spec.js:22:5:Cypress E2E tests must include at least one axeCheck call. Documentation for adding checks and understanding errors can be found here: https://depo-platform-documentation.scrollhelp.site/developer-docs/A11y-Testing.1935409178.html
LandingPage.visit({ user: USER_MOCKS.ALL_CAPS_NAME });
cy.findAllByText('Kevin').should('have.length', 2);
});
});

it('personalization disabled', () => {
Expand Down
Loading