From 4f5503af88ce48536acc6fee13d212286bf24c10 Mon Sep 17 00:00:00 2001 From: Ashray Chowdhry Date: Mon, 5 Aug 2024 13:22:58 -0400 Subject: [PATCH] added tests --- src/containers/App/index.tsx | 4 ++++ src/containers/App/test/App.test.jsx | 34 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/containers/App/index.tsx b/src/containers/App/index.tsx index 954159521..d03150b9e 100644 --- a/src/containers/App/index.tsx +++ b/src/containers/App/index.tsx @@ -108,6 +108,10 @@ export const AppWrapper = () => { path={updatePath('/index.html')} element={} /> + } + /> {/* End: Redirects */} {mode === 'custom' && ( } /> diff --git a/src/containers/App/test/App.test.jsx b/src/containers/App/test/App.test.jsx index 15674340b..29347e8c0 100644 --- a/src/containers/App/test/App.test.jsx +++ b/src/containers/App/test/App.test.jsx @@ -161,6 +161,40 @@ describe('App container', () => { ]) }) + it('renders ledger explorer page from index.html redirect', async () => { + wrapper = createWrapper('/index.html') + await flushPromises() + await flushPromises() + wrapper.update() + + expect(document.title).toEqual('xrpl_explorer | ledgers') + expect(window.dataLayer).toEqual([ + { + page_path: '/', + page_title: `xrpl_explorer | ledgers`, + event: 'screen_view', + network: 'mainnet', + }, + ]) + }) + + it('renders ledger explorer page from index.htm redirect', async () => { + wrapper = createWrapper('/index.html') + await flushPromises() + await flushPromises() + wrapper.update() + + expect(document.title).toEqual('xrpl_explorer | ledgers') + expect(window.dataLayer).toEqual([ + { + page_path: '/', + page_title: `xrpl_explorer | ledgers`, + event: 'screen_view', + network: 'mainnet', + }, + ]) + }) + it('renders not found page', () => { wrapper = createWrapper('/zzz') return new Promise((r) => setTimeout(r, 10)).then(() => {