import * as React from 'react' ; import { LoadingIndicator } from './LoadingIndicator' ; import { createTestComponent } from '@client/tests/util' ; import { createStore } from '@client/store' ; describe ( 'LoadingIndicator test cases' , ( ) => { const { store } = createStore ( ) ; it ( 'Should display the Loading text' , async ( ) => { const testComponent = await createTestComponent ( < LoadingIndicator loading = { true } hasError = { false } noApplication = { false } / > , store ) ; const isShowingLoadingText = testComponent . component . find ( 'span#loading-text' ) . length ; expect ( isShowingLoadingText ) . toBe ( 1 ) ; } ) ; it ( 'Should display the Error' , async ( ) => { const testComponent = await createTestComponent ( < LoadingIndicator loading = { false } hasError = { true } noApplication = { false } / > , store ) ; const isShowingLoadingText = testComponent . component . find ( 'div#search-result-error-text-count' ) . length ; expect ( isShowingLoadingText ) . toBe ( 1 ) ; } ) ; it ( 'Should display No application' , async ( ) => { const testComponent = await createTestComponent ( < LoadingIndicator loading = { false } hasError = { false } noApplication = { true } / > , store ) ; const isShowingLoadingText = testComponent . component . find ( 'span#no-application-text' ) . length ; expect ( isShowingLoadingText ) . toBe ( 1 ) ; } ) ; } ) ;