Skip to content

Commit 4ccd849

Browse files
jasnooMarkTeetsminzo-kimyuanjackie1
committed
updated button container RTL tests
Co-authored-by: Mark Teets <[email protected]> Co-authored-by: Jasmine Noor <[email protected]> Co-authored-by: Minzo Kim <[email protected]> Co-authored-by: Jackie Yuan <[email protected]>
1 parent e8fdb96 commit 4ccd849

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/app/__tests__/ButtonContainer.test.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ describe('Unit testing for ButtonContainer', () => {
5252
});
5353

5454
describe('When button container is loaded', () => {
55-
test('should have 5 buttons ', () => {
55+
test('should have 4 buttons ', () => {
5656
render(<ButtonsContainer />);
57-
expect(screen.getAllByRole('button')).toHaveLength(5);
57+
expect(screen.getAllByRole('button')).toHaveLength(4);
5858
expect(screen.getAllByRole('button')[0]).toHaveTextContent('Lock');
59-
expect(screen.getAllByRole('button')[1]).toHaveTextContent('Split');
60-
expect(screen.getAllByRole('button')[2]).toHaveTextContent('Download');
61-
expect(screen.getAllByRole('button')[3]).toHaveTextContent('Upload');
62-
expect(screen.getAllByRole('button')[4]).toHaveTextContent('How to use');
59+
expect(screen.getAllByRole('button')[1]).toHaveTextContent('Download');
60+
expect(screen.getAllByRole('button')[2]).toHaveTextContent('Upload');
61+
expect(screen.getAllByRole('button')[3]).toHaveTextContent('How to use');
6362
});
6463
});
6564

@@ -74,10 +73,10 @@ describe('Unit testing for ButtonContainer', () => {
7473
describe('Upload/Download', () => {
7574
test('Clicking upload and download buttons', async () => {
7675
render(<ButtonsContainer />);
76+
fireEvent.click(screen.getAllByRole('button')[1]);
7777
fireEvent.click(screen.getAllByRole('button')[2]);
78-
fireEvent.click(screen.getAllByRole('button')[3]);
78+
expect(screen.getAllByRole('button')[1]).toBeInTheDocument();
7979
expect(screen.getAllByRole('button')[2]).toBeInTheDocument();
80-
expect(screen.getAllByRole('button')[3]).toBeInTheDocument();
8180
});
8281
});
8382
});

0 commit comments

Comments
 (0)