<commit_before>describe("go.campaign.dialogue.states.choice", function() {
  var testHelpers = go.testHelpers,
      oneElExists = testHelpers.oneElExists,
      noElExists = testHelpers.noElExists;

  var dialogue = go.campaign.dialogue,
      states = go.campaign.dialogue.states;

  var setUp = dialogue.testHelpers.setUp,
      tearDown = dialogue.testHelpers.tearDown,
      newDialogueDiagram = dialogue.testHelpers.newDialogueDiagram;

  var diagram;

  beforeEach(function() {
    setUp();
    diagram = newDialogueDiagram();
  });

  afterEach(function() {
    tearDown();
  });

  describe(".EndStateEditView", function() {
    var state,
        editMode;

    beforeEach(function() {
      state = diagram.states.get('state3');
      editMode = state.modes.edit;
      state.edit();
    });

    describe(".save", function() {
      it("should update the choice state's model", function() {
        assert.deepEqual(state.model.toJSON(), {
          uuid: 'state3',
          name: 'Ending 1',
          type: 'end',
          ordinal: 2,
          text: 'Thank you for taking our survey',
          entry_endpoint: {uuid: 'endpoint5'}
        });

        editMode.$('.text').text('So Long, and Thanks for All the Fish');
        editMode.save();

        assert.deepEqual(state.model.toJSON(), {
          uuid: 'state3',
          name: 'Ending 1',
          type: 'end',
          ordinal: 2,
          text: 'So Long, and Thanks for All the Fish',
          entry_endpoint: {uuid: 'endpoint5'}
        });
      });
    });

    describe("when the '.save' button is clicked", function() {
      it("should update the choice state's model", function() {
        assert.deepEqual(state.model.toJSON(), {
          uuid: 'state3',
          name: 'Ending 1',
          type: 'end',
          ordinal: 2,
          text: 'Thank you for taking our survey',
          entry_endpoint: {uuid: 'endpoint5'}
        });

        editMode.$('.text').text('So Long, and Thanks for All the Fish');
        editMode.$('.save').click();

        assert.deepEqual(state.model.toJSON(), {
          uuid: 'state3',
          name: 'Ending 1',
          type: 'end',
          ordinal: 2,
          text: 'So Long, and Thanks for All the Fish',
          entry_endpoint: {uuid: 'endpoint5'}
        });
      });

      it("should switch back to the preview view", function() {
        assert.equal(state.modeName, 'edit');
        editMode.$('.save').click();
        assert.equal(state.modeName, 'preview');
      });
    });
  });
});
<commit_msg>Remove unnecessary fluff from dialogue end state's tests<commit_after>describe("go.campaign.dialogue.states.choice", function() {
  var dialogue = go.campaign.dialogue,
      states = go.campaign.dialogue.states;

  var setUp = dialogue.testHelpers.setUp,
      tearDown = dialogue.testHelpers.tearDown,
      newDialogueDiagram = dialogue.testHelpers.newDialogueDiagram;

  var diagram;

  beforeEach(function() {
    setUp();
    diagram = newDialogueDiagram();
  });

  afterEach(function() {
    tearDown();
  });

  describe(".EndStateEditView", function() {
    var state,
        editMode;

    beforeEach(function() {
      state = diagram.states.get('state3');
      editMode = state.modes.edit;
      state.edit();
    });

    describe(".save", function() {
      it("should update the choice state's model", function() {
        assert.deepEqual(state.model.toJSON(), {
          uuid: 'state3',
          name: 'Ending 1',
          type: 'end',
          ordinal: 2,
          text: 'Thank you for taking our survey',
          entry_endpoint: {uuid: 'endpoint5'}
        });

        editMode.$('.text').text('So Long, and Thanks for All the Fish');
        editMode.save();

        assert.deepEqual(state.model.toJSON(), {
          uuid: 'state3',
          name: 'Ending 1',
          type: 'end',
          ordinal: 2,
          text: 'So Long, and Thanks for All the Fish',
          entry_endpoint: {uuid: 'endpoint5'}
        });
      });
    });

    describe("when the '.save' button is clicked", function() {
      it("should update the choice state's model", function() {
        assert.deepEqual(state.model.toJSON(), {
          uuid: 'state3',
          name: 'Ending 1',
          type: 'end',
          ordinal: 2,
          text: 'Thank you for taking our survey',
          entry_endpoint: {uuid: 'endpoint5'}
        });

        editMode.$('.text').text('So Long, and Thanks for All the Fish');
        editMode.$('.save').click();

        assert.deepEqual(state.model.toJSON(), {
          uuid: 'state3',
          name: 'Ending 1',
          type: 'end',
          ordinal: 2,
          text: 'So Long, and Thanks for All the Fish',
          entry_endpoint: {uuid: 'endpoint5'}
        });
      });

      it("should switch back to the preview view", function() {
        assert.equal(state.modeName, 'edit');
        editMode.$('.save').click();
        assert.equal(state.modeName, 'preview');
      });
    });
  });
});

{'fraction_non_alphanumeric': 0.14832535885167464, 'fraction_numerical': 0.006778309409888357, 'mean_word_length': 2.1833756345177666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2276182', 'n_tokens_mistral': 1493, 'n_tokens_neox': 1450, 'n_words': 356}