diff --git a/VAMobile/src/screens/PaymentsScreen/PaymentHistory/NoPayments/NoPaymentsScreen.test.tsx b/VAMobile/src/screens/PaymentsScreen/PaymentHistory/NoPayments/NoPaymentsScreen.test.tsx index 37ff1265146..317296a5adb 100644 --- a/VAMobile/src/screens/PaymentsScreen/PaymentHistory/NoPayments/NoPaymentsScreen.test.tsx +++ b/VAMobile/src/screens/PaymentsScreen/PaymentHistory/NoPayments/NoPaymentsScreen.test.tsx @@ -2,8 +2,10 @@ import React from 'react' import { Linking } from 'react-native' import { fireEvent, screen } from '@testing-library/react-native' +import { t } from 'i18next' import { context, render } from 'testUtils' +import { displayedTextPhoneNumber } from 'utils/formattingUtils' import NoPaymentsScreen from './NoPaymentsScreen' @@ -13,36 +15,24 @@ context('NoPaymentsScreen', () => { }) it('initializes correctly', () => { - expect(screen.getByText("We don't have a record of VA payments for you")).toBeTruthy() - expect( - screen.getByText( - "We can't find any VA payments made to you, or returned VA payments. Some details about payments may not be available.", - ), - ).toBeTruthy() - expect( - screen.getByText( - 'VA pays benefits on the first day of the month for the previous month. Please wait at least 3 business days (Monday through Friday) before reporting non-receipt of a payment.', - ), - ).toBeTruthy() - expect( - screen.getByText( - 'If you think this is an error, or if you have questions about your payment history, please call the Veterans Help Line. We’re here Monday through Friday, 8:00 a.m. to 9:00 p.m. ET.', - ), - ).toBeTruthy() - expect(screen.getByRole('link', { name: '800-827-1000' })).toBeTruthy() - expect(screen.getByRole('link', { name: 'TTY: 711' })).toBeTruthy() + expect(screen.getByText(t('payments.noPayments.title'))).toBeTruthy() + expect(screen.getByText(t('payments.noPayments.body.1'))).toBeTruthy() + expect(screen.getByText(t('payments.missingOrNoPayments.body.1'))).toBeTruthy() + expect(screen.getByText(t('payments.noPayments.body.2'))).toBeTruthy() + expect(screen.getByRole('link', { name: displayedTextPhoneNumber(t('8008271000')) })).toBeTruthy() + expect(screen.getByRole('link', { name: t('contactVA.tty.displayText') })).toBeTruthy() }) describe('when the help phone number link is clicked', () => { it('should call Linking open url with the parameter tel:8008271000', () => { - fireEvent.press(screen.getByRole('link', { name: '800-827-1000' })) + fireEvent.press(screen.getByRole('link', { name: displayedTextPhoneNumber(t('8008271000')) })) expect(Linking.openURL).toBeCalledWith('tel:8008271000') }) }) describe('when the call TTY phone link is clicked', () => { it('should call Linking open url with the parameter tel:711', () => { - fireEvent.press(screen.getByRole('link', { name: 'TTY: 711' })) + fireEvent.press(screen.getByRole('link', { name: t('contactVA.tty.displayText') })) expect(Linking.openURL).toBeCalledWith('tel:711') }) }) diff --git a/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentHistoryScreen.test.tsx b/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentHistoryScreen.test.tsx index 0e7fb4d0246..e125c5e0907 100644 --- a/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentHistoryScreen.test.tsx +++ b/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentHistoryScreen.test.tsx @@ -1,6 +1,7 @@ import React from 'react' import { fireEvent, screen, waitFor } from '@testing-library/react-native' +import { t } from 'i18next' import { paymentsKeys } from 'api/payments' import { DEFAULT_PAGE_SIZE } from 'constants/common' @@ -89,7 +90,7 @@ context('PaymentHistoryScreen', () => { }) .mockResolvedValue(mockData) initializeTestInstance() - expect(screen.getByText('Loading your payment history...')).toBeTruthy() + expect(screen.getByText(t('payments.loading'))).toBeTruthy() }) }) @@ -107,7 +108,7 @@ context('PaymentHistoryScreen', () => { }) .mockResolvedValue(mockData) initializeTestInstance() - await waitFor(() => expect(screen.getByText("What if I'm missing a payment?")).toBeTruthy()) + await waitFor(() => expect(screen.getByText(t('payments.ifIAmMissingPayemt'))).toBeTruthy()) await waitFor(() => expect(screen.getByText('January 1, 2021')).toBeTruthy()) await waitFor(() => expect(screen.getByText('Compensation & Pension - Recurring')).toBeTruthy()) await waitFor(() => expect(screen.getByText('$3,746.20')).toBeTruthy()) @@ -133,7 +134,7 @@ context('PaymentHistoryScreen', () => { .calledWith(`/v0/payment-history`, {}) .mockResolvedValue(data) initializeTestInstance(data) - await waitFor(() => expect(screen.getByText(" We don't have a record of VA payments for you")).toBeTruthy()) + await waitFor(() => expect(screen.getByText(t('payments.noPayments.title'))).toBeTruthy()) }) }) @@ -154,7 +155,9 @@ context('PaymentHistoryScreen', () => { .calledWith(`/v0/payment-history`, {}) .mockRejectedValue({ networkError: true } as api.APIError) initializeTestInstance(data) - await waitFor(() => expect(screen.getByRole('header', { name: "The app can't be loaded." })).toBeTruthy()) + await waitFor(() => + expect(screen.getByRole('header', { name: t('errors.networkConnection.header') })).toBeTruthy(), + ) }) }) diff --git a/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentIssueScreen/PaymentIssueScreen.test.tsx b/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentIssueScreen/PaymentIssueScreen.test.tsx index 30ee5225589..b4685cbf2dd 100644 --- a/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentIssueScreen/PaymentIssueScreen.test.tsx +++ b/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentIssueScreen/PaymentIssueScreen.test.tsx @@ -2,8 +2,10 @@ import React from 'react' import { Linking } from 'react-native' import { fireEvent, screen } from '@testing-library/react-native' +import { t } from 'i18next' import { context, mockNavProps, render } from 'testUtils' +import { displayedTextPhoneNumber } from 'utils/formattingUtils' import PaymentIssue from './PaymentIssueScreen' @@ -14,24 +16,20 @@ context('PaymentIssueScreen', () => { }) it('initializes correctly', () => { - expect(screen.getByRole('header', { name: "What if my payment information doesn't look right?" })).toBeTruthy() - expect( - screen.getByText( - 'If there is an error with your payment, or if you have questions about your payment, please call the Veterans Help Line. We’re here Monday through Friday, 8:00 a.m. to 9:00 p.m. ET.', - ), - ).toBeTruthy() + expect(screen.getByRole('header', { name: t('payments.ifMyPaymentDoesNotLookRight') })).toBeTruthy() + expect(screen.getByText(t('paymentIssues.body'))).toBeTruthy() }) describe('when the help phone number link is clicked', () => { it('should call Linking open url with the parameter tel:8008271000', () => { - fireEvent.press(screen.getByRole('link', { name: '800-827-1000' })) + fireEvent.press(screen.getByRole('link', { name: displayedTextPhoneNumber(t('8008271000')) })) expect(Linking.openURL).toBeCalledWith('tel:8008271000') }) }) describe('when the call TTY phone link is clicked', () => { it('should call Linking open url with the parameter tel:711', () => { - fireEvent.press(screen.getByRole('link', { name: 'TTY: 711' })) + fireEvent.press(screen.getByRole('link', { name: t('contactVA.tty.displayText') })) expect(Linking.openURL).toBeCalledWith('tel:711') }) }) diff --git a/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentMissingSceen/PaymentMissingScreen.test.tsx b/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentMissingSceen/PaymentMissingScreen.test.tsx index b6b7ef271d8..964717234cb 100644 --- a/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentMissingSceen/PaymentMissingScreen.test.tsx +++ b/VAMobile/src/screens/PaymentsScreen/PaymentHistory/PaymentMissingSceen/PaymentMissingScreen.test.tsx @@ -2,8 +2,10 @@ import React from 'react' import { Linking } from 'react-native' import { fireEvent, screen } from '@testing-library/react-native' +import { t } from 'i18next' import { context, mockNavProps, render } from 'testUtils' +import { displayedTextPhoneNumber } from 'utils/formattingUtils' import PaymentMissing from './PaymentMissingScreen' @@ -14,24 +16,20 @@ context('PaymentMissing', () => { }) it('initializes correctly', () => { - expect(screen.getByRole('header', { name: "What if I'm missing a payment?" })).toBeTruthy() - expect( - screen.getByText( - 'VA pays benefits on the first day of the month for the previous month. Please wait at least 3 business days (Monday through Friday) before reporting non-receipt of a payment.', - ), - ).toBeTruthy() + expect(screen.getByRole('header', { name: t('payments.ifIAmMissingPayemt') })).toBeTruthy() + expect(screen.getByText(t('payments.missingOrNoPayments.body.1'))).toBeTruthy() }) describe('when the help phone number link is clicked', () => { it('should call Linking open url with the parameter tel:8008271000', () => { - fireEvent.press(screen.getByRole('link', { name: '800-827-1000' })) + fireEvent.press(screen.getByRole('link', { name: displayedTextPhoneNumber(t('8008271000')) })) expect(Linking.openURL).toBeCalledWith('tel:8008271000') }) }) describe('when the call TTY phone link is clicked', () => { it('should call Linking open url with the parameter tel:711', () => { - fireEvent.press(screen.getByRole('link', { name: 'TTY: 711' })) + fireEvent.press(screen.getByRole('link', { name: t('contactVA.tty.displayText') })) expect(Linking.openURL).toBeCalledWith('tel:711') }) })