@@ -5,6 +5,8 @@ import { TextEncoder } from 'util';
5
5
global . TextEncoder = TextEncoder ;
6
6
import ButtonsContainer from '../containers/ButtonsContainer' ;
7
7
import { useStoreContext } from '../store' ;
8
+ import userEvent from '@testing-library/user-event' ;
9
+ import { toggleMode } from '../actions/actions' ;
8
10
9
11
// const { Steps } = require('intro.js-react');
10
12
jest . mock ( '../store' ) ;
@@ -69,6 +71,24 @@ describe('Unit testing for ButtonContainer', () => {
69
71
} ) ;
70
72
} ) ;
71
73
74
+ describe ( 'When view is lock' , ( ) => {
75
+ test ( 'Button should show as locked' , ( ) => {
76
+ state . tabs [ '87' ] . mode . paused = false ;
77
+ render ( < ButtonsContainer /> ) ;
78
+ expect ( screen . getAllByRole ( 'button' ) [ 0 ] ) . toHaveTextContent ( 'Unlocked' ) ;
79
+ } ) ;
80
+ } ) ;
81
+
82
+ describe ( 'Clicking pause-button toggles locked/unlocked' , ( ) => {
83
+ test ( 'When button is unlocked and it is clicked' , async ( ) => {
84
+ render ( < ButtonsContainer /> ) ;
85
+ const button = screen . getAllByRole ( 'button' ) [ 0 ] ;
86
+ await userEvent . click ( button ) ;
87
+ expect ( dispatch ) . toHaveBeenCalledWith ( toggleMode ( 'paused' ) ) ;
88
+ } ) ;
89
+ } ) ;
90
+
91
+
72
92
describe ( 'Upload/Download' , ( ) => {
73
93
test ( 'Clicking upload and download buttons' , async ( ) => {
74
94
render ( < ButtonsContainer /> ) ;
0 commit comments