Skip to content

Commit

Permalink
make tests faster
Browse files Browse the repository at this point in the history
  • Loading branch information
mvadari committed Jul 7, 2023
1 parent e626109 commit a9e63c7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/containers/App/test/App.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('App container', () => {

it('renders home', () => {
wrapper = createWrapper()
return new Promise((r) => setTimeout(r, 100)).then(() => {
return new Promise((r) => setTimeout(r, 10)).then(() => {
expect(document.title).toEqual('xrpl_explorer | ledgers')
expect(wrapper.find('header')).not.toHaveClassName('header-no-network')
expect(wrapper.find('.ledgers').length).toBe(1)
Expand Down Expand Up @@ -163,7 +163,7 @@ describe('App container', () => {

it('renders not found page', () => {
wrapper = createWrapper('/zzz')
return new Promise((r) => setTimeout(r, 100)).then(() => {
return new Promise((r) => setTimeout(r, 10)).then(() => {
expect(document.title).toEqual('xrpl_explorer | not_found_default_title')
expect(window.dataLayer).toEqual([
{
Expand Down Expand Up @@ -223,7 +223,7 @@ describe('App container', () => {
it('renders transaction page with invalid hash', () => {
const id = '12345'
wrapper = createWrapper(`/transactions/${id}`)
return new Promise((r) => setTimeout(r, 100)).then(() => {
return new Promise((r) => setTimeout(r, 10)).then(() => {
expect(document.title).toEqual(`xrpl_explorer | invalid_transaction_hash`)
expect(window.dataLayer).toEqual([
{
Expand All @@ -238,7 +238,7 @@ describe('App container', () => {

it('renders transaction page with no hash', () => {
wrapper = createWrapper(`/transactions/`)
return new Promise((r) => setTimeout(r, 100)).then(() => {
return new Promise((r) => setTimeout(r, 10)).then(() => {
expect(wrapper.find('.no-match .title')).toHaveText(
'transaction_empty_title',
)
Expand All @@ -261,7 +261,7 @@ describe('App container', () => {
wrapper = createWrapper(`/accounts/${id}#ssss`)
flushPromises()
flushPromises()
return new Promise((r) => setTimeout(r, 100)).then(() => {
return new Promise((r) => setTimeout(r, 10)).then(() => {
expect(document.title).toEqual(`xrpl_explorer | rKV8HEL3vLc6...`)
expect(window.dataLayer).toEqual([
{
Expand All @@ -279,7 +279,7 @@ describe('App container', () => {
wrapper = createWrapper(`/accounts/${id}#ssss`, [], () =>
Promise.reject(new Error('account not found', 404)),
)
return new Promise((r) => setTimeout(r, 100)).then(() => {
return new Promise((r) => setTimeout(r, 10)).then(() => {
expect(document.title).toEqual(`xrpl_explorer | invalid_xrpl_address`)
expect(window.dataLayer).toEqual([
{
Expand All @@ -297,7 +297,7 @@ describe('App container', () => {
wrapper = createWrapper(`/accounts/${id}#ssss`, [], () =>
Promise.reject(new Error('account not found', 404)),
)
return new Promise((r) => setTimeout(r, 100)).then(() => {
return new Promise((r) => setTimeout(r, 10)).then(() => {
expect(document.title).toEqual(`xrpl_explorer | r35jYntLwkrb...`)
expect(window.dataLayer).toEqual([
{
Expand All @@ -317,7 +317,7 @@ describe('App container', () => {
it('renders account page for x-address', () => {
const id = 'XVVFXHFdehYhofb7XRWeJYV6kjTEwboaHpB9S1ruYMsuXcG'
wrapper = createWrapper(`/accounts/${id}#ssss`)
return new Promise((r) => setTimeout(r, 100)).then(() => {
return new Promise((r) => setTimeout(r, 10)).then(() => {
expect(document.title).toEqual(`xrpl_explorer | XVVFXHFdehYh...`)
expect(window.dataLayer).toEqual([
{
Expand All @@ -337,7 +337,7 @@ describe('App container', () => {

it('renders account page with no id', () => {
wrapper = createWrapper(`/accounts/`)
return new Promise((r) => setTimeout(r, 100)).then(() => {
return new Promise((r) => setTimeout(r, 10)).then(() => {
expect(wrapper.find('.no-match .title')).toHaveText('account_empty_title')
expect(wrapper.find('.no-match .hint')).toHaveText('account_empty_hint')
expect(window.dataLayer).toEqual([
Expand All @@ -355,7 +355,7 @@ describe('App container', () => {
const id =
'50BB0CC6EFC4F5EF9954E654D3230D4480DC83907A843C736B28420C7F02F774'
wrapper = createWrapper(`/#/transactions/${id}`)
return new Promise((r) => setTimeout(r, 100)).then(() => {
return new Promise((r) => setTimeout(r, 10)).then(() => {
expect(document.title).toEqual(
`xrpl_explorer | transaction_short 50BB0CC6...`,
)
Expand All @@ -378,7 +378,7 @@ describe('App container', () => {
it('redirects legacy account page', () => {
const id = 'rKV8HEL3vLc6q9waTiJcewdRdSFyx67QFb'
wrapper = createWrapper(`/#/graph/${id}#ssss`)
return new Promise((r) => setTimeout(r, 100)).then(() => {
return new Promise((r) => setTimeout(r, 10)).then(() => {
expect(document.title).toEqual(`xrpl_explorer | rKV8HEL3vLc6...`)
expect(window.dataLayer).toEqual([
{
Expand Down

0 comments on commit a9e63c7

Please sign in to comment.