fix: Fix tests broken by @backstage/core-components update
Signed-off-by: Carlos Esteban Lopez <lcarlosesteb@vmware.com>
This commit is contained in:
committed by
Carlos Lopez
parent
830687539f
commit
1326691934
@@ -16,7 +16,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import * as deployments from '../../__fixtures__/2-deployments.json';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { renderInTestApp, textContentMatcher } from '@backstage/test-utils';
|
||||
import { DeploymentDrawer } from './DeploymentDrawer';
|
||||
|
||||
describe('DeploymentDrawer', () => {
|
||||
@@ -33,9 +33,13 @@ describe('DeploymentDrawer', () => {
|
||||
expect(getByText('YAML')).toBeInTheDocument();
|
||||
expect(getByText('Strategy')).toBeInTheDocument();
|
||||
expect(getByText('Rolling Update:')).toBeInTheDocument();
|
||||
expect(getByText('Max Surge: 25%')).toBeInTheDocument();
|
||||
expect(getByText('Max Unavailable: 25%')).toBeInTheDocument();
|
||||
expect(getByText('Type: RollingUpdate')).toBeInTheDocument();
|
||||
expect(getByText(textContentMatcher('Max Surge: 25%'))).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(textContentMatcher('Max Unavailable: 25%')),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(textContentMatcher('Type: RollingUpdate')),
|
||||
).toBeInTheDocument();
|
||||
expect(getByText('Min Ready Seconds')).toBeInTheDocument();
|
||||
expect(getByText('???')).toBeInTheDocument();
|
||||
expect(getByText('Progress Deadline Seconds')).toBeInTheDocument();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import * as ingresses from './__fixtures__/2-ingresses.json';
|
||||
import { wrapInTestApp } from '@backstage/test-utils';
|
||||
import { textContentMatcher, wrapInTestApp } from '@backstage/test-utils';
|
||||
import { IngressDrawer } from './IngressDrawer';
|
||||
|
||||
describe('IngressDrawer', () => {
|
||||
@@ -28,11 +28,17 @@ describe('IngressDrawer', () => {
|
||||
),
|
||||
);
|
||||
|
||||
expect(getAllByText('awesome-service')).toHaveLength(2);
|
||||
expect(getAllByText('awesome-service')).toHaveLength(4);
|
||||
expect(getByText('YAML')).toBeInTheDocument();
|
||||
expect(getByText('Rules')).toBeInTheDocument();
|
||||
expect(getByText('Host: api.awesome-host.io')).toBeInTheDocument();
|
||||
expect(getAllByText('Service Port: 80')).toHaveLength(2);
|
||||
expect(getAllByText('Service Name: awesome-service')).toHaveLength(2);
|
||||
expect(
|
||||
getByText(textContentMatcher('Host: api.awesome-host.io')),
|
||||
).toBeInTheDocument();
|
||||
expect(getAllByText(textContentMatcher('Service Port: 80'))).toHaveLength(
|
||||
2,
|
||||
);
|
||||
expect(
|
||||
getAllByText(textContentMatcher('Service Name: awesome-service')),
|
||||
).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
|
||||
+15
-7
@@ -18,7 +18,7 @@ import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import * as pod from './__fixtures__/pod.json';
|
||||
import * as crashingPod from './__fixtures__/crashing-pod.json';
|
||||
import { wrapInTestApp } from '@backstage/test-utils';
|
||||
import { textContentMatcher, wrapInTestApp } from '@backstage/test-utils';
|
||||
import { PodDrawer } from './PodDrawer';
|
||||
|
||||
describe('PodDrawer', () => {
|
||||
@@ -46,8 +46,10 @@ describe('PodDrawer', () => {
|
||||
expect(getAllByText('True')).toHaveLength(4);
|
||||
expect(getByText('Exposed Ports')).toBeInTheDocument();
|
||||
expect(getByText('Nginx:')).toBeInTheDocument();
|
||||
expect(getByText('Container Port: 80')).toBeInTheDocument();
|
||||
expect(getByText('Protocol: TCP')).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(textContentMatcher('Container Port: 80')),
|
||||
).toBeInTheDocument();
|
||||
expect(getByText(textContentMatcher('Protocol: TCP'))).toBeInTheDocument();
|
||||
});
|
||||
it('should render crashing pod', async () => {
|
||||
const { getByText, getAllByText } = render(
|
||||
@@ -80,12 +82,18 @@ describe('PodDrawer', () => {
|
||||
getAllByText('containers with unready status: [side-car other-side-car]'),
|
||||
).toHaveLength(2);
|
||||
expect(getByText('Exposed Ports')).toBeInTheDocument();
|
||||
expect(getAllByText('Protocol: TCP')).toHaveLength(3);
|
||||
expect(getAllByText(textContentMatcher('Protocol: TCP'))).toHaveLength(3);
|
||||
expect(getByText('Nginx:')).toBeInTheDocument();
|
||||
expect(getByText('Container Port: 80')).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(textContentMatcher('Container Port: 80')),
|
||||
).toBeInTheDocument();
|
||||
expect(getByText('Side Car:')).toBeInTheDocument();
|
||||
expect(getByText('Container Port: 81')).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(textContentMatcher('Container Port: 81')),
|
||||
).toBeInTheDocument();
|
||||
expect(getByText('Other Side Car:')).toBeInTheDocument();
|
||||
expect(getByText('Container Port: 82')).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(textContentMatcher('Container Port: 82')),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import * as services from './__fixtures__/2-services.json';
|
||||
import { wrapInTestApp } from '@backstage/test-utils';
|
||||
import { textContentMatcher, wrapInTestApp } from '@backstage/test-utils';
|
||||
import { ServiceDrawer } from './ServiceDrawer';
|
||||
|
||||
describe('ServiceDrawer', () => {
|
||||
@@ -33,7 +33,11 @@ describe('ServiceDrawer', () => {
|
||||
expect(getByText('YAML')).toBeInTheDocument();
|
||||
expect(getByText('Cluster IP')).toBeInTheDocument();
|
||||
expect(getByText('Ports')).toBeInTheDocument();
|
||||
expect(getByText('Target Port: 1997')).toBeInTheDocument();
|
||||
expect(getByText('App: awesome-service')).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(textContentMatcher('Target Port: 1997')),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(textContentMatcher('App: awesome-service')),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
+12
-6
@@ -16,7 +16,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import * as statefulsets from '../../__fixtures__/2-statefulsets.json';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { renderInTestApp, textContentMatcher } from '@backstage/test-utils';
|
||||
import { StatefulSetDrawer } from './StatefulSetDrawer';
|
||||
|
||||
describe('StatefulSetDrawer', () => {
|
||||
@@ -28,19 +28,25 @@ describe('StatefulSetDrawer', () => {
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(getAllByText('dice-roller')).toHaveLength(3);
|
||||
expect(getAllByText('dice-roller')).toHaveLength(4);
|
||||
expect(getByText('StatefulSet')).toBeInTheDocument();
|
||||
expect(getByText('YAML')).toBeInTheDocument();
|
||||
expect(getByText('Type: RollingUpdate')).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(textContentMatcher('Type: RollingUpdate')),
|
||||
).toBeInTheDocument();
|
||||
expect(getByText('Rolling Update:')).toBeInTheDocument();
|
||||
expect(getByText('Max Surge: 25%')).toBeInTheDocument();
|
||||
expect(getByText('Max Unavailable: 25%')).toBeInTheDocument();
|
||||
expect(getByText(textContentMatcher('Max Surge: 25%'))).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(textContentMatcher('Max Unavailable: 25%')),
|
||||
).toBeInTheDocument();
|
||||
expect(getByText('Pod Management Policy')).toBeInTheDocument();
|
||||
expect(getByText('Parallel')).toBeInTheDocument();
|
||||
expect(getByText('Service Name')).toBeInTheDocument();
|
||||
expect(getByText('Selector')).toBeInTheDocument();
|
||||
expect(getByText('Match Labels:')).toBeInTheDocument();
|
||||
expect(getByText('App: dice-roller')).toBeInTheDocument();
|
||||
expect(
|
||||
getByText(textContentMatcher('App: dice-roller')),
|
||||
).toBeInTheDocument();
|
||||
expect(getByText('Revision History Limit')).toBeInTheDocument();
|
||||
expect(getByText('10')).toBeInTheDocument();
|
||||
expect(getByText('namespace: default')).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user