Skip to content

Commit a3ea4f6

Browse files
committed
test: update test for PluggableComponent
1 parent 2f41a23 commit a3ea4f6

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/components/PluggableComponent/index.test.jsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('PluggableComponent', () => {
2121
beforeEach(() => {
2222
jest.resetModules();
2323
});
24-
it('renders correctly', async () => {
24+
test('renders correctly', async () => {
2525
const handleClickMock = jest.fn();
2626
const props = {
2727
title: 'button title',
@@ -48,7 +48,7 @@ describe('PluggableComponent', () => {
4848
});
4949
});
5050

51-
it('loads children component when import is invalid', async () => {
51+
test('loads children component when import is invalid', async () => {
5252
render(
5353
<PluggableComponent id="est-pluggable" as="invalid import">
5454
<div data-testid="plugin">Plugin Loaded</div>
@@ -62,7 +62,7 @@ describe('PluggableComponent', () => {
6262
});
6363
});
6464

65-
it('loads children component when import is empty', async () => {
65+
test('loads children component when import is empty', async () => {
6666
render(
6767
<PluggableComponent
6868
id="test-pluggable"
@@ -79,7 +79,7 @@ describe('PluggableComponent', () => {
7979
});
8080
});
8181

82-
it('returns null when do not have children and import is invalid', async () => {
82+
test('returns null when do not have children and import is invalid', async () => {
8383
render(
8484
<PluggableComponent
8585
id="test-pluggable"
@@ -92,7 +92,7 @@ describe('PluggableComponent', () => {
9292
});
9393
});
9494

95-
it('updates component when props change', async () => {
95+
test('updates component when props change', async () => {
9696
const { rerender } = render(
9797
<PluggableComponent
9898
id="test-pluggable"
@@ -118,7 +118,7 @@ describe('PluggableComponent', () => {
118118
});
119119
});
120120

121-
it('updates component when children change', async () => {
121+
test('updates component when children change', async () => {
122122
const { getByText, getByTestId } = render(
123123
<PluggableComponent
124124
id="test-pluggable"
@@ -136,15 +136,14 @@ describe('PluggableComponent', () => {
136136
const toggleButton = getByText('Toggle Content');
137137
fireEvent.click(toggleButton);
138138

139-
// Now, after toggling the content, we expect it to be visible inside PluggableComponent
140139
await waitFor(() => {
141140
const toggleContent = getByTestId('toggle-content');
142141
expect(toggleContent).toBeInTheDocument();
143142
expect(toggleContent).toHaveTextContent('Toggle On');
144143
});
145144
});
146145

147-
it('renders loadingComponent while the plugin is loading', async () => {
146+
test('renders loadingComponent while the plugin is loading', async () => {
148147
jest.mock('./utils', () => ({
149148
isPluginAvailable: jest.fn().mockImplementation(
150149
() => new Promise((resolve) => {

src/components/PluggableComponent/utils.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import { isPluginAvailable } from './utils';
22

33
describe('isPluginAvailable util', () => {
4-
it('returns true if a plugin is installed', async () => {
4+
test('returns true if a plugin is installed', async () => {
55
const checkBoxPlugin = await isPluginAvailable('communications-app-check-box-form');
66
expect(checkBoxPlugin).toBe(true);
77
});
88

9-
it('returns false if a plugin is not installed', async () => {
9+
test('returns false if a plugin is not installed', async () => {
1010
const nonexistentPlugin = await isPluginAvailable('nonexistentPlugin');
1111
expect(nonexistentPlugin).toBe(false);
1212
});
1313

14-
it('returns false if an empty string is provided as plugin name', async () => {
14+
test('returns false if an empty string is provided as plugin name', async () => {
1515
const emptyPlugin = await isPluginAvailable('');
1616
expect(emptyPlugin).toBe(false);
1717
});
1818

19-
it('returns false if null is provided as plugin name', async () => {
19+
test('returns false if null is provided as plugin name', async () => {
2020
const nullPLugin = await isPluginAvailable(null);
2121
expect(nullPLugin).toBe(false);
2222
});

0 commit comments

Comments
 (0)