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

chore: updated PaymentHistory screens with i18n #10249

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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')
})
})
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -89,7 +90,7 @@ context('PaymentHistoryScreen', () => {
})
.mockResolvedValue(mockData)
initializeTestInstance()
expect(screen.getByText('Loading your payment history...')).toBeTruthy()
expect(screen.getByText(t('payments.loading'))).toBeTruthy()
})
})

Expand All @@ -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())
Expand All @@ -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())
})
})

Expand All @@ -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(),
)
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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')
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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')
})
})
Expand Down
Loading