-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Services): ♻️ Re organize services
- Loading branch information
Showing
17 changed files
with
190 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
__tests__/pages/Services/TcpTerminatedConnections.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Suspense } from 'react'; | ||
|
||
import { render, waitForElementToBeRemoved } from '@testing-library/react'; | ||
import { Server } from 'miragejs'; | ||
|
||
import TcpTerminatedConnections from '@pages/Services/components/TcpTerminatedConnections'; | ||
|
||
import flowPairsData from '../../../mocks/data/FLOW_PAIRS.json'; | ||
import servicesData from '../../../mocks/data/SERVICES.json'; | ||
import { loadMockServer } from '../../../mocks/server'; | ||
import { waitForElementToBeRemovedTimeout } from '../../../src/config/config'; | ||
import { getTestsIds } from '../../../src/config/testIds'; | ||
import { Wrapper } from '../../../src/core/components/Wrapper'; | ||
import LoadingPage from '../../../src/pages/shared/Loading'; | ||
|
||
const servicesResults = servicesData.results; | ||
const tcpBiFlowTerminated = flowPairsData.results[6]; | ||
|
||
describe('Begin testing the TCP connections component', () => { | ||
let server: Server; | ||
|
||
beforeEach(() => { | ||
server = loadMockServer() as Server; | ||
server.logging = false; | ||
}); | ||
|
||
afterEach(() => { | ||
server.shutdown(); | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('should render the Connection view -> Old Connections after the data loading is complete', async () => { | ||
const { queryByTestId, getByText, getAllByText } = render( | ||
<Wrapper> | ||
<Suspense fallback={<LoadingPage />}> | ||
<TcpTerminatedConnections id={servicesResults[4].identity} name={servicesResults[4].name} /> | ||
</Suspense> | ||
</Wrapper> | ||
); | ||
|
||
await waitForElementToBeRemoved(() => queryByTestId(getTestsIds.loadingView()), { | ||
timeout: waitForElementToBeRemovedTimeout | ||
}); | ||
|
||
expect(getAllByText(tcpBiFlowTerminated.sourceProcessName)[0]).toBeInTheDocument(); | ||
expect(getByText('Closed')).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.