Skip to content

Commit

Permalink
Merge branch 'develop' into feature/labsAndTests
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenBarrs committed Feb 19, 2025
2 parents 72791a1 + 0694526 commit 572787a
Show file tree
Hide file tree
Showing 16 changed files with 337 additions and 65 deletions.
16 changes: 8 additions & 8 deletions VAMobile/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ GEM
public_suffix (>= 2.0.2, < 7.0)
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.1050.0)
aws-sdk-core (3.218.1)
aws-eventstream (1.3.1)
aws-partitions (1.1052.0)
aws-sdk-core (3.219.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
base64
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.98.0)
aws-sdk-kms (1.99.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.180.0)
aws-sdk-s3 (1.182.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -140,12 +140,12 @@ GEM
google-cloud-env (2.2.1)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.4.0)
google-cloud-storage (1.54.0)
google-cloud-storage (1.55.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-apis-core (~> 0.13)
google-apis-iamcredentials_v1 (~> 0.18)
google-apis-storage_v1 (~> 0.38)
google-apis-storage_v1 (>= 0.42)
google-cloud-core (~> 1.6)
googleauth (~> 1.9)
mini_mime (~> 1.0)
Expand Down Expand Up @@ -184,7 +184,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.4.0)
rexml (3.4.1)
rouge (2.0.7)
ruby2_keywords (0.0.5)
rubyzip (2.4.1)
Expand Down
14 changes: 7 additions & 7 deletions VAMobile/ios/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ GEM
json (>= 1.5.1)
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.1050.0)
aws-sdk-core (3.218.1)
aws-eventstream (1.3.1)
aws-partitions (1.1052.0)
aws-sdk-core (3.219.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
base64
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.98.0)
aws-sdk-kms (1.99.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.180.0)
aws-sdk-s3 (1.182.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -225,7 +225,7 @@ GEM
json (2.10.1)
jwt (2.10.1)
base64
logger (1.6.5)
logger (1.6.6)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.25.4)
Expand All @@ -247,7 +247,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.4.0)
rexml (3.4.1)
rouge (3.28.0)
ruby-macho (2.5.1)
ruby2_keywords (0.0.5)
Expand Down
37 changes: 28 additions & 9 deletions VAMobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ PODS:
- React-Core
- react-native-safe-area-context (4.10.9):
- React-Core
- react-native-webview (13.10.4):
- react-native-webview (13.12.3):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1763,9 +1763,28 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNKeychain (8.2.0):
- RNKeychain (9.2.1):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Core
- RNLocalize (3.2.1):
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNLocalize (3.3.0):
- React-Core
- RNReactNativeHapticFeedback (2.3.3):
- DoubleConversion
Expand Down Expand Up @@ -2121,7 +2140,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: 4cb898d0bf20404aab1850c656dcea009429d6c1
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
FBLazyVector: 7b438dceb9f904bd85ca3c31d64cce32a035472b
Firebase: 10c8cb12fb7ad2ae0c09ffc86cd9c1ab392a0031
FirebaseABTesting: d87f56707159bae64e269757a6e963d490f2eebe
Expand All @@ -2137,7 +2156,7 @@ SPEC CHECKSUMS:
FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc
FirebaseSharedSwift: 20530f495084b8d840f78a100d8c5ee613375f6e
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
glog: 69ef571f3de08433d766d614c73a9838a06bf7eb
GoogleAppMeasurement: bb3c564c3efb933136af0e94899e0a46167466a8
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
Expand Down Expand Up @@ -2184,7 +2203,7 @@ SPEC CHECKSUMS:
react-native-image-picker: 2fbbafdae7a7c6db9d25df2f2b1db4442d2ca2ad
react-native-notifications: 4601a5a8db4ced6ae7cfc43b44d35fe437ac50c4
react-native-safe-area-context: ab8f4a3d8180913bd78ae75dd599c94cce3d5e9a
react-native-webview: fbafd1591cd068bd599f0d1afb0ddc19718908fa
react-native-webview: 926d2665cf3196e39c4449a72d136d0a53b9df8a
React-nativeconfig: 4a9543185905fe41014c06776bf126083795aed9
React-NativeModulesApple: 0506da59fc40d2e1e6e12a233db5e81c46face27
React-perflogger: 3bbb82f18e9ac29a1a6931568e99d6305ef4403b
Expand Down Expand Up @@ -2222,15 +2241,15 @@ SPEC CHECKSUMS:
RNFBRemoteConfig: bfb9f6a04a0269038a352d8386e5c77f4ff98125
RNFileViewer: ce7ca3ac370e18554d35d6355cffd7c30437c592
RNGestureHandler: 939f21fabf5d45a725c0bf175eb819dd25cf2e70
RNKeychain: bfe3d12bf4620fe488771c414530bf16e88f3678
RNLocalize: 4f22418187ecd5ca693231093ff1d912d1b3c9bc
RNKeychain: dcd1e815934f8657555f82b033800705a4cae4ba
RNLocalize: 298e85ce16540a11de40c1a588ead39fc5e9a072
RNReactNativeHapticFeedback: 0d591ea1e150f36cb96d868d4e8d77272243d78a
RNScreens: 19719a9c326e925498ac3b2d35c4e50fe87afc06
RNSVG: 963a95f1f5d512a13d11ffd50d351c87fb5c6890
SDWebImage: 8a6b7b160b4d710e2a22b6900e25301075c34cb3
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: 1354c027ab07c7736f99a3bef16172d6f1b12b47
Yoga: 4ef80d96a5534f0e01b3055f17d1e19a9fc61b63

PODFILE CHECKSUM: 528e5ac3a06c35c8645d8271610e36fdcca33735

Expand Down
4 changes: 4 additions & 0 deletions VAMobile/ios/VAMobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@
"${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact/React-cxxreact_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/boost/boost_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/glog/glog_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/react-native-blob-util/ReactNativeBlobUtilPrivacyInfo.bundle",
);
name = "[CP] Copy Pods Resources";
Expand All @@ -512,6 +513,7 @@
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-cxxreact_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SDWebImage.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/boost_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/glog_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ReactNativeBlobUtilPrivacyInfo.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -552,6 +554,7 @@
"${PODS_CONFIGURATION_BUILD_DIR}/React-cxxreact/React-cxxreact_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/boost/boost_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/glog/glog_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/react-native-blob-util/ReactNativeBlobUtilPrivacyInfo.bundle",
);
name = "[CP] Copy Pods Resources";
Expand All @@ -569,6 +572,7 @@
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/React-cxxreact_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SDWebImage.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/boost_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/glog_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ReactNativeBlobUtilPrivacyInfo.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
8 changes: 8 additions & 0 deletions VAMobile/jest/testSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ jest.mock('react-native-keychain', () => {
SECURE_HARDWARE: 'SECURE_HARDWARE',
ANY: 'ANY',
},
STORAGE_TYPE: {
FB: 'MOCK_FacebookConceal',
AES: 'MOCK_KeystoreAESGCM',
AES_GCM: 'MOCK_KeystoreAESCBC',
AES_GCM_NO_AUTH: 'MOCK_KeystoreAESGCMNoAuth',
RSA: 'MOCK_KeystoreRSAECB',
KC: 'MOCK_keychain',
},
SECURITY_LEVEL_ANY: 'MOCK_SECURITY_LEVEL_ANY',
SECURITY_LEVEL_SECURE_SOFTWARE: 'MOCK_SECURITY_LEVEL_SECURE_SOFTWARE',
SECURITY_LEVEL_SECURE_HARDWARE: 'MOCK_SECURITY_LEVEL_SECURE_HARDWARE',
Expand Down
2 changes: 1 addition & 1 deletion VAMobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"react-native-haptic-feedback": "^2.3.3",
"react-native-image-picker": "^7.1.2",
"react-native-keyboard-manager": "^6.5.11-2",
"react-native-keychain": "^9.1.0",
"react-native-keychain": "^9.2.0",
"react-native-localize": "^3.3.0",
"react-native-notifications": "^5.1.0",
"react-native-safe-area-context": "^4.10.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ export const ChildTemplate: FC<ChildTemplateProps> = ({
transitionHeader(event.nativeEvent.contentOffset.y)
}}
{...scrollViewProps}>
<View onLayout={getTransitionHeaderHeight}>
{!screenReaderEnabled ? <TextView {...subtitleProps}>{title}</TextView> : null}
<View accessible accessibilityLabel={titleA11y} onLayout={getTransitionHeaderHeight}>
{!screenReaderEnabled ? <TextView {...subtitleProps}>{title}</TextView> : <TextView>{'\u200B'}</TextView>}
</View>
<WaygateWrapper>{children}</WaygateWrapper>
</VAScrollView>
Expand Down
2 changes: 1 addition & 1 deletion VAMobile/src/components/Templates/HeaderBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const HeaderBanner: FC<HeaderBannerProps> = ({
useFocusEffect(focus === 'Title' ? setFocusTitle : setFocus)
const screenReaderEnabled = useIsScreenReaderEnabled()

const TEXT_CONSTRAINT_THRESHOLD = 30
const TEXT_CONSTRAINT_THRESHOLD = 26

const transition = title?.type === 'Transition'

Expand Down
20 changes: 20 additions & 0 deletions VAMobile/src/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,26 @@ export const DIRECT_DEPOSIT = 'Direct Deposit'
export const MAX_DIGITS = 10
export const MAX_DIGITS_AFTER_FORMAT = 14

// ------------------
// REGEX PATTERNS FOR PII
// ------------------
export const EMAIL_REGEX_EXP_PII = new RegExp(
/(?<![a-zA-Z0-9@._-])(([^<>()\]\\.,;:\s@"]+(\.[^<>()\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}))(?![a-zA-Z0-9@._-])/gi,
)

export const MAIL_TO_REGEX_EXP_PII = new RegExp(
/(?<![a-zA-Z0-9@_-])(?:mailto:)?(([^<>()\]\\.,;:\s@"]+(\.[^<>()\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}))(?![a-zA-Z0-9@_-])/gi,
)

export const PHONE_REGEX_EXP_PII = new RegExp(
/(?<!\d)(?:\+?\d{1,3}[-.\s(]*)?\(?\d{3}\)?[-.\s]*\d{3}[-.\s]*\d{4}(?: *(?:x|ext)\.? *\d+)?(?!\d)/gi,
)

export const SSN_REGEX_EXP_PII = new RegExp(/(?<!\d)\d{3}-?\d{2}-?\d{4}(?!\d)/g)

// ------------------
// REGEX PATTERNS FOR LINKING TEXT
// ------------------
export const EMAIL_REGEX_EXP = new RegExp(
/^(([^<>()\]\\.,;:\s@"]+(\.[^<>()\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import React from 'react'
import { Alert } from 'react-native'

import { StackScreenProps } from '@react-navigation/stack'

import { waitFor } from '@testing-library/react-native'
import { RootNavStackParamList } from 'App'
import { t } from 'i18next'

import { context, fireEvent, render, screen } from 'testUtils'

import InAppFeedbackScreen from './InAppFeedbackScreen'

const mockNavigationSpy = jest.fn()
jest.mock('utils/hooks', () => {
const original = jest.requireActual('utils/hooks')
return {
...original,
useRouteNavigation: () => mockNavigationSpy,
}
})

context('InAppFeedbackScreen', () => {
const initializeTestInstance = () => {
const props = {
navigation: {
goBack: jest.fn(),
addListener: jest.fn().mockReturnValue(() => {}),
},
route: {
params: {
screen: 'InAppFeedback',
},
},
} as unknown as StackScreenProps<RootNavStackParamList, 'InAppFeedback'>

render(<InAppFeedbackScreen {...props} />)
return props
}

beforeEach(() => {
jest.spyOn(Alert, 'alert').mockClear()
})

describe('onSubmit behavior with various inputs', () => {
const submitFeedback = (text: string) => {
fireEvent.changeText(screen.getByTestId('AppFeedbackTaskID'), text)
fireEvent.press(screen.getByRole('button', { name: t('inAppFeedback.submitFeedback') }))
}

it('does NOT alert for normal text', async () => {
initializeTestInstance()
submitFeedback('Hello, I want to submit some feedback.')
await waitFor(() => {
// No alert means no PII found
expect(Alert.alert).not.toHaveBeenCalled()
})
})

// ------------------
// SSN TEST CASES
// ------------------
it('alerts for an SSN with leading punctuation', async () => {
initializeTestInstance()
submitFeedback('My SSN:123-45-6789')
await waitFor(() => {
expect(Alert.alert).toHaveBeenCalled()
})
})

// ------------------
// PHONE NUMBER TEST CASES
// ------------------
it('alerts for a phone number with leading text', async () => {
initializeTestInstance()
submitFeedback('Call me123-456-7890')
await waitFor(() => {
expect(Alert.alert).toHaveBeenCalled()
})
})

it('alerts for a phone number with trailing punctuation', async () => {
initializeTestInstance()
submitFeedback('Call me at 123-456-7890.')
await waitFor(() => {
expect(Alert.alert).toHaveBeenCalled()
})
})

// ------------------
// EMAIL TEST CASES
// ------------------
it('alerts for a valid email address', async () => {
initializeTestInstance()
submitFeedback('Please email me at [email protected]')
await waitFor(() => {
expect(Alert.alert).toHaveBeenCalled()
})
})

it('alerts for an email address with leading punctuation', async () => {
initializeTestInstance()
submitFeedback('My email is,[email protected], thanks!')
await waitFor(() => {
expect(Alert.alert).toHaveBeenCalled()
})
})

// ------------------
// MAILTO TEST CASES
// ------------------
it('alerts for a mailto link with leading punctuation', async () => {
initializeTestInstance()
submitFeedback('(mailto:[email protected])')
await waitFor(() => {
expect(Alert.alert).toHaveBeenCalled()
})
})
})
})
Loading

0 comments on commit 572787a

Please sign in to comment.