diff --git a/packages/legacy/core/App/App.tsx b/packages/legacy/core/App/App.tsx
index d507bb738c..17a940b486 100644
--- a/packages/legacy/core/App/App.tsx
+++ b/packages/legacy/core/App/App.tsx
@@ -9,10 +9,6 @@ import { animatedComponents } from './animated-components'
import ErrorModal from './components/modals/ErrorModal'
import NetInfo from './components/network/NetInfo'
import toastConfig from './components/toast/ToastConfig'
-import { credentialOfferTourSteps } from './components/tour/CredentialOfferTourSteps'
-import { credentialsTourSteps } from './components/tour/CredentialsTourSteps'
-import { homeTourSteps } from './components/tour/HomeTourSteps'
-import { proofRequestTourSteps } from './components/tour/ProofRequestTourSteps'
import { Container, ContainerProvider } from './container-api'
import { ActivityProvider } from './contexts/activity'
import { AnimatedComponentsProvider } from './contexts/animated-components'
@@ -25,6 +21,7 @@ import { initLanguages, initStoredLanguage, translationResources } from './local
import RootStack from './navigators/RootStack'
import { theme } from './theme'
import { OpenIDCredentialRecordProvider } from './modules/openid/context/OpenIDCredentialRecordProvider'
+import { tours } from './constants'
const App = (system: Container): React.FC => {
initLanguages(translationResources)
@@ -58,14 +55,7 @@ const App = (system: Container): React.FC => {
/>
-
+
diff --git a/packages/legacy/core/App/constants.ts b/packages/legacy/core/App/constants.ts
index c09b6147dc..b459c08b55 100644
--- a/packages/legacy/core/App/constants.ts
+++ b/packages/legacy/core/App/constants.ts
@@ -1,4 +1,9 @@
+import { Tours } from 'contexts/tour/tour-context'
import { PINValidationRules } from './types/security'
+import { homeTourSteps } from './components/tour/HomeTourSteps'
+import { credentialsTourSteps } from './components/tour/CredentialsTourSteps'
+import { credentialOfferTourSteps } from './components/tour/CredentialOfferTourSteps'
+import { proofRequestTourSteps } from './components/tour/ProofRequestTourSteps'
const lengthOfHiddenAttributes = 10
const unicodeForBulletCharacter = '\u2022'
@@ -63,6 +68,13 @@ export const attemptLockoutThresholdRules = {
export const defaultAutoLockTime = 5
+export const tours: Tours = {
+ homeTourSteps,
+ credentialsTourSteps,
+ credentialOfferTourSteps,
+ proofRequestTourSteps,
+}
+
export const walletId = 'walletId'
export const minPINLength = 6
diff --git a/packages/legacy/core/App/contexts/tour/tour-context.tsx b/packages/legacy/core/App/contexts/tour/tour-context.tsx
index a543f22708..5accfbc147 100644
--- a/packages/legacy/core/App/contexts/tour/tour-context.tsx
+++ b/packages/legacy/core/App/contexts/tour/tour-context.tsx
@@ -1,7 +1,11 @@
import { createContext, ReactElement, useContext } from 'react'
import { LayoutRectangle } from 'react-native'
-import { TourID } from '../../types/tour'
+import { BaseTourID, TourID } from '../../types/tour'
+
+export type Tours = {
+ [key: TourID]: TourStep[]
+}
export interface RenderProps {
/**
@@ -112,21 +116,9 @@ export interface TourCtx extends Tour {
*/
spot: LayoutRectangle
/**
- * The list of steps for the home tour.
- */
- homeTourSteps: TourStep[]
- /**
- * Same as above for the credential list screen
- */
- credentialsTourSteps: TourStep[]
- /**
- * Same as above for the credential offer screen
- */
- credentialOfferTourSteps: TourStep[]
- /**
- * Same as above for the proof request screen
+ * A dictionnary where the key is...
*/
- proofRequestTourSteps: TourStep[]
+ tours: Tours
}
export const ORIGIN_SPOT: LayoutRectangle = {
@@ -137,17 +129,14 @@ export const ORIGIN_SPOT: LayoutRectangle = {
}
export const TourContext = createContext({
- currentTour: TourID.HomeTour,
+ currentTour: BaseTourID.HomeTour,
currentStep: undefined,
changeSpot: () => undefined,
next: () => undefined,
previous: () => undefined,
spot: ORIGIN_SPOT,
start: () => undefined,
- homeTourSteps: [],
- credentialsTourSteps: [],
- credentialOfferTourSteps: [],
- proofRequestTourSteps: [],
+ tours: {},
stop: () => undefined,
})
diff --git a/packages/legacy/core/App/contexts/tour/tour-provider.tsx b/packages/legacy/core/App/contexts/tour/tour-provider.tsx
index c39e6a276a..e74459fde4 100644
--- a/packages/legacy/core/App/contexts/tour/tour-provider.tsx
+++ b/packages/legacy/core/App/contexts/tour/tour-provider.tsx
@@ -2,10 +2,19 @@ import React, { forwardRef, Ref, useCallback, useImperativeHandle, useMemo, useS
import { ColorValue, LayoutRectangle } from 'react-native'
import { TourOverlay } from '../../components/tour/TourOverlay'
-import { ChildFn, TourID } from '../../types/tour'
+import { BaseTourID, ChildFn, TourID } from '../../types/tour'
import { isChildFunction } from '../../utils/helpers'
-import { BackdropPressBehavior, OSConfig, Tour, TourContext, TourCtx, TourStep, ORIGIN_SPOT } from './tour-context'
+import {
+ BackdropPressBehavior,
+ OSConfig,
+ Tour,
+ TourContext,
+ TourCtx,
+ TourStep,
+ ORIGIN_SPOT,
+ Tours,
+} from './tour-context'
export interface TourProviderProps {
children: React.ReactNode | ChildFn
@@ -45,19 +54,7 @@ export interface TourProviderProps {
/**
* The list of steps for the home tour.
*/
- homeTourSteps: TourStep[]
- /**
- * Same as above for the credential list screen
- */
- credentialsTourSteps: TourStep[]
- /**
- * Same as above for the credential offer screen
- */
- credentialOfferTourSteps: TourStep[]
- /**
- * Same as above for the proof request screen
- */
- proofRequestTourSteps: TourStep[]
+ tours: Tours
}
const TourProviderComponent = (props: TourProviderProps, ref: Ref) => {
@@ -66,29 +63,21 @@ const TourProviderComponent = (props: TourProviderProps, ref: Ref) => {
onBackdropPress,
overlayColor = 'black',
overlayOpacity = 0.45,
- homeTourSteps,
- credentialsTourSteps,
- credentialOfferTourSteps,
- proofRequestTourSteps,
+ tours,
nativeDriver = false,
} = props
- const [currentTour, setCurrentTour] = useState(TourID.HomeTour)
+ const [currentTour, setCurrentTour] = useState(BaseTourID.HomeTour)
const [currentStep, setCurrentStep] = useState()
const [spot, setSpot] = useState(ORIGIN_SPOT)
const renderStep = useCallback(
(index: number): void | Promise => {
- if (
- (currentTour === TourID.HomeTour && homeTourSteps[index] !== undefined) ||
- (currentTour === TourID.CredentialsTour && credentialsTourSteps[index] !== undefined) ||
- (currentTour === TourID.CredentialOfferTour && credentialOfferTourSteps[index] !== undefined) ||
- (currentTour === TourID.ProofRequestTour && proofRequestTourSteps[index] !== undefined)
- ) {
+ if (tours[currentTour]?.[index] !== undefined) {
setCurrentStep(index)
}
},
- [currentTour, homeTourSteps, credentialsTourSteps, credentialOfferTourSteps, proofRequestTourSteps]
+ [currentTour, tours]
)
const changeSpot = useCallback((newSpot: LayoutRectangle): void => {
@@ -109,30 +98,11 @@ const TourProviderComponent = (props: TourProviderProps, ref: Ref) => {
}, [])
const next = useCallback((): void => {
- let steps = homeTourSteps
- if (currentTour === TourID.CredentialsTour) {
- steps = credentialsTourSteps
- } else if (currentTour === TourID.CredentialOfferTour) {
- steps = credentialOfferTourSteps
- } else if (currentTour === TourID.ProofRequestTour) {
- steps = proofRequestTourSteps
+ if (currentTour && currentStep !== undefined && tours[currentTour]) {
+ currentStep === tours[currentTour].length - 1 ? stop() : renderStep(currentStep + 1)
}
+ }, [stop, renderStep, currentStep, currentTour, tours])
- if (currentStep !== undefined) {
- currentStep === steps.length - 1 ? stop() : renderStep(currentStep + 1)
- }
- }, [
- stop,
- renderStep,
- currentStep,
- currentTour,
- homeTourSteps,
- credentialsTourSteps,
- credentialOfferTourSteps,
- proofRequestTourSteps,
- ])
-
- // works the same regardless of which tour is on
const previous = useCallback((): void => {
if (currentStep !== undefined && currentStep > 0) {
renderStep(currentStep - 1)
@@ -140,19 +110,8 @@ const TourProviderComponent = (props: TourProviderProps, ref: Ref) => {
}, [renderStep, currentStep])
const tourStep = useMemo((): TourStep => {
- let stepToRender = undefined
- let steps = homeTourSteps
- if (currentTour === TourID.CredentialsTour) {
- steps = credentialsTourSteps
- } else if (currentTour === TourID.CredentialOfferTour) {
- steps = credentialOfferTourSteps
- } else if (currentTour === TourID.ProofRequestTour) {
- steps = proofRequestTourSteps
- }
-
- stepToRender = currentStep !== undefined ? steps[currentStep] : undefined
- return stepToRender ?? { Render: () => <>> }
- }, [homeTourSteps, currentTour, credentialsTourSteps, credentialOfferTourSteps, proofRequestTourSteps, currentStep])
+ return tours[currentTour]?.[currentStep ?? 0] ?? { Render: () => <>> }
+ }, [currentTour, currentStep, tours])
const tour = useMemo(
(): TourCtx => ({
@@ -164,25 +123,9 @@ const TourProviderComponent = (props: TourProviderProps, ref: Ref) => {
spot,
start,
stop,
- homeTourSteps,
- credentialsTourSteps,
- credentialOfferTourSteps,
- proofRequestTourSteps,
+ tours,
}),
- [
- changeSpot,
- currentTour,
- currentStep,
- next,
- previous,
- spot,
- start,
- stop,
- homeTourSteps,
- credentialsTourSteps,
- credentialOfferTourSteps,
- proofRequestTourSteps,
- ]
+ [changeSpot, currentTour, currentStep, next, previous, spot, start, stop, tours]
)
useImperativeHandle(ref, () => ({
diff --git a/packages/legacy/core/App/index.ts b/packages/legacy/core/App/index.ts
index 40c3af6dd3..bd567c5a03 100644
--- a/packages/legacy/core/App/index.ts
+++ b/packages/legacy/core/App/index.ts
@@ -50,7 +50,7 @@ import * as types from './types'
import Scan from './screens/Scan'
import Onboarding from './screens/Onboarding'
import { DefaultScreenOptionsDictionary, useDefaultStackOptions } from './navigators/defaultStackOptions'
-import { PINRules, walletTimeout } from './constants'
+import { PINRules, walletTimeout, tours } from './constants'
import { CredentialListFooterProps } from './types/credential-list-footer'
import { OpenIDCredentialRecordProvider } from './modules/openid/context/OpenIDCredentialRecordProvider'
import { defaultConfig, defaultHistoryEventsLogger } from './container-impl'
@@ -83,7 +83,13 @@ export { BifoldError } from './types/error'
export { EventTypes } from './constants'
export { migrateToAskar } from './utils/migration'
export { createLinkSecretIfRequired, getAgentModules } from './utils/agent'
-export { removeExistingInvitationIfRequired, connectFromScanOrDeepLink, formatTime, useCredentialConnectionLabel, getConnectionName } from './utils/helpers'
+export {
+ removeExistingInvitationIfRequired,
+ connectFromScanOrDeepLink,
+ formatTime,
+ useCredentialConnectionLabel,
+ getConnectionName,
+} from './utils/helpers'
export { isValidAnonCredsCredential, getCredentialIdentifiers } from './utils/credential'
export { buildFieldsFromAnonCredsCredential } from './utils/oca'
@@ -135,6 +141,8 @@ export { MainContainer } from './container-impl'
export type { ScreenLayoutConfig } from './types/navigators'
export type { HistoryEventsLoggerConfig } from './types/config'
+export { BaseTourID } from './types/tour'
+
export {
App,
Agent,
@@ -195,6 +203,7 @@ export {
BulletPoint,
PINRules,
walletTimeout,
+ tours,
DefaultScreenOptionsDictionary,
DefaultScreenLayoutOptions,
}
diff --git a/packages/legacy/core/App/navigators/TabStack.tsx b/packages/legacy/core/App/navigators/TabStack.tsx
index ff24ba912f..ad72899424 100644
--- a/packages/legacy/core/App/navigators/TabStack.tsx
+++ b/packages/legacy/core/App/navigators/TabStack.tsx
@@ -19,12 +19,12 @@ import { useStore } from '../contexts/store'
import { useTheme } from '../contexts/theme'
import { BifoldError } from '../types/error'
import { Screens, Stacks, TabStackParams, TabStacks } from '../types/navigators'
-import { TourID } from '../types/tour'
import { connectFromScanOrDeepLink } from '../utils/helpers'
import { testIdWithKey } from '../utils/testable'
import CredentialStack from './CredentialStack'
import HomeStack from './HomeStack'
+import { BaseTourID } from '../types/tour'
const TabStack: React.FC = () => {
const { fontScale } = useWindowDimensions()
@@ -128,7 +128,7 @@ const TabStack: React.FC = () => {
options={{
tabBarIconStyle: styles.tabBarIcon,
tabBarIcon: ({ color, focused }) => (
-
+
@@ -168,7 +168,7 @@ const TabStack: React.FC = () => {
width: 90,
}}
>
-
+
{
margin: 'auto',
}}
>
-
+
{
options={{
tabBarIconStyle: styles.tabBarIcon,
tabBarIcon: ({ color, focused }) => (
-
+
{showLabels && (
diff --git a/packages/legacy/core/App/screens/CredentialOffer.tsx b/packages/legacy/core/App/screens/CredentialOffer.tsx
index 8f856319e8..6ddc7a7b5b 100644
--- a/packages/legacy/core/App/screens/CredentialOffer.tsx
+++ b/packages/legacy/core/App/screens/CredentialOffer.tsx
@@ -27,7 +27,6 @@ import { HistoryCardType, HistoryRecord } from '../modules/history/types'
import { BifoldError } from '../types/error'
import { Screens, TabStacks } from '../types/navigators'
import { ModalUsage } from '../types/remove'
-import { TourID } from '../types/tour'
import { useAppAgent } from '../utils/agent'
import { parseCredDefFromId } from '../utils/cred-def'
import { getCredentialIdentifiers, isValidAnonCredsCredential } from '../utils/credential'
@@ -36,6 +35,7 @@ import { buildFieldsFromAnonCredsCredential } from '../utils/oca'
import { testIdWithKey } from '../utils/testable'
import CredentialOfferAccept from './CredentialOfferAccept'
+import { BaseTourID } from '../types/tour'
type CredentialOfferProps = {
navigation: any
@@ -93,7 +93,7 @@ const CredentialOffer: React.FC = ({ navigation, credentia
useEffect(() => {
const shouldShowTour = enableToursConfig && store.tours.enableTours && !store.tours.seenCredentialOfferTour
if (shouldShowTour && screenIsFocused) {
- start(TourID.CredentialOfferTour)
+ start(BaseTourID.CredentialOfferTour)
dispatch({
type: DispatchAction.UPDATE_SEEN_CREDENTIAL_OFFER_TOUR,
payload: [true],
@@ -278,7 +278,7 @@ const CredentialOffer: React.FC = ({ navigation, credentia
}}
>
{loading ? : null}
- {(credentialConnectionLabel && goalCode === 'aries.vc.issue') && (
+ {credentialConnectionLabel && goalCode === 'aries.vc.issue' && (
)}
diff --git a/packages/legacy/core/App/screens/Home.tsx b/packages/legacy/core/App/screens/Home.tsx
index ad946ed3ee..78cd401bd6 100644
--- a/packages/legacy/core/App/screens/Home.tsx
+++ b/packages/legacy/core/App/screens/Home.tsx
@@ -12,7 +12,7 @@ import { useStore } from '../contexts/store'
import { useTheme } from '../contexts/theme'
import { useTour } from '../contexts/tour/tour-context'
import { HomeStackParams, Screens } from '../types/navigators'
-import { TourID } from '../types/tour'
+import { BaseTourID } from '../types/tour'
type HomeProps = StackScreenProps
@@ -46,29 +46,32 @@ const Home: React.FC = () => {
},
})
- const DisplayListItemType = useCallback((item: any): React.ReactNode => {
- let component: React.ReactNode
- if (item.type === 'BasicMessageRecord') {
- component =
- } else if (item.type === 'CredentialRecord') {
- let notificationType = NotificationType.CredentialOffer
- if (item.revocationNotification) {
- notificationType = NotificationType.Revocation
+ const DisplayListItemType = useCallback(
+ (item: any): React.ReactNode => {
+ let component: React.ReactNode
+ if (item.type === 'BasicMessageRecord') {
+ component =
+ } else if (item.type === 'CredentialRecord') {
+ let notificationType = NotificationType.CredentialOffer
+ if (item.revocationNotification) {
+ notificationType = NotificationType.Revocation
+ }
+ component =
+ } else if (item.type === 'CustomNotification' && customNotification) {
+ component = (
+
+ )
+ } else {
+ component =
}
- component =
- } else if (item.type === 'CustomNotification' && customNotification) {
- component = (
-
- )
- } else {
- component =
- }
- return component
- }, [customNotification, NotificationListItem])
+ return component
+ },
+ [customNotification, NotificationListItem]
+ )
useEffect(() => {
const shouldShowTour = enableToursConfig && store.tours.enableTours && !store.tours.seenHomeTour
@@ -78,7 +81,7 @@ const Home: React.FC = () => {
type: DispatchAction.UPDATE_SEEN_HOME_TOUR,
payload: [true],
})
- start(TourID.HomeTour)
+ start(BaseTourID.HomeTour)
} else {
setShowTourPopup(true)
}
@@ -107,7 +110,7 @@ const Home: React.FC = () => {
type: DispatchAction.UPDATE_SEEN_TOUR_PROMPT,
payload: [true],
})
- start(TourID.HomeTour)
+ start(BaseTourID.HomeTour)
}, [dispatch, start])
const onDismissPressed = useCallback(() => {
diff --git a/packages/legacy/core/App/screens/ListCredentials.tsx b/packages/legacy/core/App/screens/ListCredentials.tsx
index d5720fd2dd..f0c16eafb5 100644
--- a/packages/legacy/core/App/screens/ListCredentials.tsx
+++ b/packages/legacy/core/App/screens/ListCredentials.tsx
@@ -13,13 +13,13 @@ import { useStore } from '../contexts/store'
import { useTheme } from '../contexts/theme'
import { useTour } from '../contexts/tour/tour-context'
import { RootStackParams, Screens } from '../types/navigators'
-import { TourID } from '../types/tour'
import { TOKENS, useServices } from '../container-api'
import { EmptyListProps } from '../components/misc/EmptyList'
import { CredentialListFooterProps } from '../types/credential-list-footer'
import { useOpenIDCredentials } from '../modules/openid/context/OpenIDCredentialRecordProvider'
import { GenericCredentialExchangeRecord } from '../types/credentials'
import { CredentialErrors } from '../components/misc/CredentialCard11'
+import { BaseTourID } from '../types/tour'
const ListCredentials: React.FC = () => {
const { t } = useTranslation()
@@ -64,7 +64,7 @@ const ListCredentials: React.FC = () => {
const shouldShowTour = enableToursConfig && store.tours.enableTours && !store.tours.seenCredentialsTour
if (shouldShowTour && screenIsFocused) {
- start(TourID.CredentialsTour)
+ start(BaseTourID.CredentialsTour)
dispatch({
type: DispatchAction.UPDATE_SEEN_CREDENTIALS_TOUR,
payload: [true],
diff --git a/packages/legacy/core/App/screens/ProofRequest.tsx b/packages/legacy/core/App/screens/ProofRequest.tsx
index 1f1d630cd1..7abdeb8ef6 100644
--- a/packages/legacy/core/App/screens/ProofRequest.tsx
+++ b/packages/legacy/core/App/screens/ProofRequest.tsx
@@ -49,7 +49,6 @@ import {
ProofCredentialPredicates,
} from '../types/proof-items'
import { ModalUsage } from '../types/remove'
-import { TourID } from '../types/tour'
import { useAppAgent } from '../utils/agent'
import { DescriptorMetadata } from '../utils/anonCredsProofRequestMapper'
import {
@@ -65,6 +64,7 @@ import LoadingPlaceholder, { LoadingPlaceholderWorkflowType } from '../component
import ProofRequestAccept from './ProofRequestAccept'
import { CredentialErrors } from '../components/misc/CredentialCard11'
import { HistoryCardType, HistoryRecord } from '../modules/history/types'
+import { BaseTourID } from '../types/tour'
type ProofRequestProps = {
navigation: any
@@ -203,7 +203,7 @@ const ProofRequest: React.FC = ({ navigation, proofId }) => {
const shouldShowTour = enableToursConfig && store.tours.enableTours && !store.tours.seenProofRequestTour
if (shouldShowTour && screenIsFocused) {
- start(TourID.ProofRequestTour)
+ start(BaseTourID.ProofRequestTour)
dispatch({
type: DispatchAction.UPDATE_SEEN_PROOF_REQUEST_TOUR,
payload: [true],
diff --git a/packages/legacy/core/App/types/state.ts b/packages/legacy/core/App/types/state.ts
index 9508bf27bd..aace95f5e3 100644
--- a/packages/legacy/core/App/types/state.ts
+++ b/packages/legacy/core/App/types/state.ts
@@ -41,6 +41,7 @@ export interface Tours {
seenCredentialsTour: boolean
seenCredentialOfferTour: boolean
seenProofRequestTour: boolean
+ [key: `seen${string}Tour`]: boolean
}
export interface Lockout {
diff --git a/packages/legacy/core/App/types/tour.ts b/packages/legacy/core/App/types/tour.ts
index 544f22a4cb..561dc7eaad 100644
--- a/packages/legacy/core/App/types/tour.ts
+++ b/packages/legacy/core/App/types/tour.ts
@@ -10,9 +10,11 @@ export type Optional = T | undefined
*/
export type ChildFn = (value: T) => ReactNode
-export enum TourID {
- HomeTour = 1,
- CredentialsTour,
- CredentialOfferTour,
- ProofRequestTour,
+export enum BaseTourID {
+ HomeTour = 'homeTourSteps',
+ CredentialsTour = 'credentialsTourSteps',
+ CredentialOfferTour = 'credentialOfferTourSteps',
+ ProofRequestTour = 'proofRequestTourSteps',
}
+
+export type TourID = `${string}TourSteps`
diff --git a/packages/legacy/core/__tests__/components/AttachTourStep.test.tsx b/packages/legacy/core/__tests__/components/AttachTourStep.test.tsx
index 959e3c06aa..c316c9609f 100644
--- a/packages/legacy/core/__tests__/components/AttachTourStep.test.tsx
+++ b/packages/legacy/core/__tests__/components/AttachTourStep.test.tsx
@@ -3,25 +3,15 @@ import React from 'react'
import { View } from 'react-native'
import { AttachTourStep } from '../../App/components/tour/AttachTourStep'
-import { credentialOfferTourSteps } from '../../App/components/tour/CredentialOfferTourSteps'
-import { credentialsTourSteps } from '../../App/components/tour/CredentialsTourSteps'
-import { homeTourSteps } from '../../App/components/tour/HomeTourSteps'
-import { proofRequestTourSteps } from '../../App/components/tour/ProofRequestTourSteps'
import { TourProvider } from '../../App/contexts/tour/tour-provider'
-import { TourID } from '../../App/types/tour'
+import { tours } from '../../App/constants'
+import { BaseTourID } from '../../App/types/tour'
describe('AttachTourStep Component', () => {
test('Renders properly with defaults', () => {
const tree = render(
-
-
+
+
diff --git a/packages/legacy/core/__tests__/components/SpotCutout.test.tsx b/packages/legacy/core/__tests__/components/SpotCutout.test.tsx
index 9d41c38876..f7cb7147b8 100644
--- a/packages/legacy/core/__tests__/components/SpotCutout.test.tsx
+++ b/packages/legacy/core/__tests__/components/SpotCutout.test.tsx
@@ -1,34 +1,26 @@
import { act, render } from '@testing-library/react-native'
import React from 'react'
-import { credentialOfferTourSteps } from '../../App/components/tour/CredentialOfferTourSteps'
-import { credentialsTourSteps } from '../../App/components/tour/CredentialsTourSteps'
-import { homeTourSteps } from '../../App/components/tour/HomeTourSteps'
-import { proofRequestTourSteps } from '../../App/components/tour/ProofRequestTourSteps'
import { SpotCutout } from '../../App/components/tour/SpotCutout'
import { TourProvider } from '../../App/contexts/tour/tour-provider'
+import { tours } from '../../App/constants'
describe('SpotCutout Component', () => {
- beforeAll(()=>{
+ beforeAll(() => {
jest.useFakeTimers()
})
- afterAll(()=>{
+ afterAll(() => {
jest.useRealTimers()
})
test('Renders properly with defaults', async () => {
const tree = render(
-
+
)
- await act(()=>{ jest.runAllTimers() })
+ await act(() => {
+ jest.runAllTimers()
+ })
expect(tree).toMatchSnapshot()
})
})
diff --git a/packages/legacy/core/__tests__/components/TourBox.test.tsx b/packages/legacy/core/__tests__/components/TourBox.test.tsx
index 818cdd0cc1..8adaa5290d 100644
--- a/packages/legacy/core/__tests__/components/TourBox.test.tsx
+++ b/packages/legacy/core/__tests__/components/TourBox.test.tsx
@@ -1,14 +1,11 @@
import { fireEvent, render } from '@testing-library/react-native'
import React from 'react'
-import { credentialOfferTourSteps } from '../../App/components/tour/CredentialOfferTourSteps'
-import { credentialsTourSteps } from '../../App/components/tour/CredentialsTourSteps'
-import { homeTourSteps } from '../../App/components/tour/HomeTourSteps'
-import { proofRequestTourSteps } from '../../App/components/tour/ProofRequestTourSteps'
import { TourBox } from '../../App/components/tour/TourBox'
import { TourProvider } from '../../App/contexts/tour/tour-provider'
-import { TourID } from '../../App/types/tour'
import { testIdWithKey } from '../../App/utils/testable'
+import { tours } from '../../App/constants'
+import { BaseTourID } from '../../App/types/tour'
describe('TourBox Component', () => {
test('Renders properly with defaults', () => {
@@ -16,21 +13,14 @@ describe('TourBox Component', () => {
const next = jest.fn()
const stop = jest.fn()
const tree = render(
-
+
{
@@ -21,28 +18,21 @@ const tourStep = {
}
describe('TourOverlay Component', () => {
- beforeAll(()=>{
+ beforeAll(() => {
jest.useFakeTimers()
})
- afterAll(()=>{
+ afterAll(() => {
jest.useRealTimers()
})
test('Renders properly with defaults', async () => {
const changeSpot = jest.fn()
const onBackdropPress = jest.fn()
const tree = render(
-
+
{
/>
)
- await act(()=>{ jest.runAllTimers() })
+ await act(() => {
+ jest.runAllTimers()
+ })
expect(tree).toMatchSnapshot()
})
})