import ButtonSetter from '../../src/helpers/ButtonSetter';
import INITIAL_OPTIONS from '../../src/helpers/Constants';

describe('ButtonSetters', () => {
  describe('setButtonOnTimeline', () => {
    it('従来のレイアウト(not React)', () => {
      const buttonSetter = new ButtonSetter();
      buttonSetter._setButtonOnTimeline = jest.fn();
      buttonSetter._setButtonOnReactLayoutTimeline = jest.fn();

      buttonSetter.setButtonOnTimeline(INITIAL_OPTIONS);
      expect(buttonSetter._setButtonOnTimeline).toHaveBeenCalledTimes(1);
      expect(buttonSetter._setButtonOnReactLayoutTimeline).not.toHaveBeenCalled();
    });

    it('新しいレイアウト(React)', () => {
      const buttonSetter = new ButtonSetter();
      buttonSetter._setButtonOnTimeline = jest.fn();
      buttonSetter._setButtonOnReactLayoutTimeline = jest.fn();

      const root = document.createElement('div');
      root.setAttribute('id', 'react-root');
      document.querySelector('body').appendChild(root);
      buttonSetter.setButtonOnTimeline(INITIAL_OPTIONS);
      expect(buttonSetter._setButtonOnTimeline).not.toHaveBeenCalled();
      expect(buttonSetter._setButtonOnReactLayoutTimeline).toHaveBeenCalledTimes(1);
    });
  });
});

@@ -58,16 +58,18 @@
 ;%0Aimport
+ %7B
  INITIAL
@@ -76,16 +76,18 @@
 _OPTIONS
+ %7D
  from '.
@@ -444,32 +444,33 @@
 ITIAL_OPTIONS);%0A
+%0A
       expect(but
@@ -523,24 +523,122 @@
 edTimes(1);%0A
+      expect(buttonSetter._setButtonOnTimeline.mock.calls%5B0%5D%5B0%5D).toStrictEqual(INITIAL_OPTIONS);%0A%0A
       expect
@@ -1124,16 +1124,17 @@
 TIONS);%0A
+%0A
       ex
@@ -1193,24 +1193,25 @@
 enCalled();%0A
+%0A
       expect
@@ -1279,24 +1279,132 @@
 edTimes(1);%0A
+      expect(buttonSetter._setButtonOnReactLayoutTimeline.mock.calls%5B0%5D%5B0%5D).toStrictEqual(INITIAL_OPTIONS);%0A
     %7D);%0A  %7D)

fix import, check args