<commit_before>import React from "react"
import { mount } from "enzyme"
import { expect } from "chai"
import sinon from "sinon"

import StageProgressionButton from "../../web/static/js/components/stage_progression_button"


describe("StageProgressionButton", () => {
  context("onClick", () => {
    it("invokes a javascript confirmation", () => {
      const mockRetroChannel = { on: () => {}, push: () => {} }
      const confirmSpy = sinon.spy(global, "confirm")

      const wrapper = mount(
        <StageProgressionButton
          retroChannel={mockRetroChannel}
        />
      )

      wrapper.simulate("click")
      expect(confirmSpy.called).to.equal(true)

      confirmSpy.restore()
    })

    describe("stage progression confirmation", () => {
      let confirmStub
      let stageProgressionButton
      let retroChannel

      beforeEach(() => {
        confirmStub = sinon.stub(global, "confirm")
        retroChannel = { on: () => {}, push: sinon.spy() }

        stageProgressionButton = mount(
          <StageProgressionButton
            retroChannel={retroChannel}
          />
        )
      })

      afterEach(() => {
        confirmStub.restore()
      })

      context("when the user confirms", () => {
        it("pushes a `show_action_item` event to the retro channel, passing show_action_item: true", () => {<commit_msg>One-line calls to mount(<StageProgressionButton />)<commit_after>import React from "react"
import { mount } from "enzyme"
import { expect } from "chai"
import sinon from "sinon"

import StageProgressionButton from "../../web/static/js/components/stage_progression_button"


describe("StageProgressionButton", () => {
  context("onClick", () => {
    it("invokes a javascript confirmation", () => {
      const mockRetroChannel = { on: () => {}, push: () => {} }
      const confirmSpy = sinon.spy(global, "confirm")

      const wrapper = mount(<StageProgressionButton retroChannel={mockRetroChannel} />)

      wrapper.simulate("click")
      expect(confirmSpy.called).to.equal(true)

      confirmSpy.restore()
    })

    describe("stage progression confirmation", () => {
      let confirmStub
      let stageProgressionButton
      let retroChannel

      beforeEach(() => {
        confirmStub = sinon.stub(global, "confirm")
        retroChannel = { on: () => {}, push: sinon.spy() }

        stageProgressionButton = mount(<StageProgressionButton retroChannel={retroChannel} />)
      })

      afterEach(() => {
        confirmStub.restore()
      })

      context("when the user confirms", () => {
        it("pushes a `show_action_item` event to the retro channel with show_action_item: true", () => {
{'fraction_non_alphanumeric': 0.14130434782608695, 'fraction_numerical': 0.0, 'mean_word_length': 2.942392909896603, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4036077', 'n_tokens_mistral': 769, 'n_tokens_neox': 746, 'n_words': 162}