Skip to content

Commit

Permalink
Merge pull request #26 from oslabs-beta/mike-textencoder
Browse files Browse the repository at this point in the history
added button container tests
  • Loading branch information
j-mccoll committed Jun 20, 2023
2 parents d751158 + 6c2c07d commit ce2db4a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/app/__tests__/ButtonContainer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { TextEncoder } from 'util';
global.TextEncoder = TextEncoder;
import ButtonsContainer from '../containers/ButtonsContainer';
import { useStoreContext } from '../store';
import userEvent from '@testing-library/user-event';
import { toggleMode } from '../actions/actions';

// const { Steps } = require('intro.js-react');
jest.mock('../store');
Expand Down Expand Up @@ -69,6 +71,24 @@ describe('Unit testing for ButtonContainer', () => {
});
});

describe('When view is lock', () => {
test('Button should show as locked', () => {
state.tabs['87'].mode.paused = false;
render(<ButtonsContainer />);
expect(screen.getAllByRole('button')[0]).toHaveTextContent('Unlocked');
});
});

describe('Clicking pause-button toggles locked/unlocked', () => {
test('When button is unlocked and it is clicked', async () => {
render(<ButtonsContainer />);
const button = screen.getAllByRole('button')[0];
await userEvent.click(button);
expect(dispatch).toHaveBeenCalledWith(toggleMode('paused'));
});
});


describe('Upload/Download', () => {
test('Clicking upload and download buttons', async () => {
render(<ButtonsContainer />);
Expand Down

0 comments on commit ce2db4a

Please sign in to comment.