<commit_before>require File.dirname(__FILE__) + '/../test_helper'
require './integration_test'

class DiffControllerTest < IntegrationTest

  test "show tag_0-tag_1 diff with no change to any file" do
    id = checked_save_id

    get 'dojo/start_json', {
      :id => id
    }
    avatar_name = json['avatar_name']    
    
    post '/kata/edit', {
      :id => id,
      :avatar => avatar_name
    }
    
    post 'kata/run_tests', {
      :id => id,
      :avatar => avatar_name,
      :file_content => {
        quoted('cyber-dojo.sh') => ""
      },
      :file_hashes_incoming => {
        'cyber-dojo.sh' => 234234
      },
      :file_hashes_outgoing => {
        'cyber-dojo.sh' => -4545645678
      }      
    }
    
    get "diff/show", {
      :id => id,
      :avatar => avatar_name,
      :was_tag => 0,
      :now_tag => 1
    }
    assert_response :success
    
    get "diff/heartbeat", {
      :id => id,
      :avatar => avatar_name,
      :was_tag => 0,
      :now_tag => 1      
    }
  end
  
  #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  
  test "show tag_1-tag_1 (no diff) no change in any file" do
    id = checked_save_id
    kata = Kata.new(root_dir, id)    

    get 'dojo/start_json', {
      :id => id
    }
    avatar_name = json['avatar_name']    

    post '/kata/edit', {
      :id => id,
      :avatar => avatar_name
    }

    post 'kata/run_tests', {
      :id => id,
      :avatar => avatar_name,
      :file_content => {
        quoted('cyber-dojo.sh') => 'echo hello'
      },
      :file_hashes_incoming => {
        'cyber-dojo.sh' => 234234
      },
      :file_hashes_outgoing => {
        'cyber-dojo.sh' => -4545645678
      }      
    }

    get "diff/show", {
      :id => id,
      :avatar => avatar_name,
      :was_tag => 1,
      :now_tag => 1
    }
    assert_response :success
  end
  
  #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  
  test "help_dialog" do
    id = checked_save_id
    get "/diff/help_dialog"
    assert_response :success    
  end
  
end

<commit_msg>diff-controller help now a dialog<commit_after>require File.dirname(__FILE__) + '/../test_helper'
require './integration_test'

class DiffControllerTest < IntegrationTest

  test "show tag_0-tag_1 diff with no change to any file" do
    id = checked_save_id

    get 'dojo/start_json', {
      :id => id
    }
    avatar_name = json['avatar_name']    
    
    post '/kata/edit', {
      :id => id,
      :avatar => avatar_name
    }
    
    post 'kata/run_tests', {
      :id => id,
      :avatar => avatar_name,
      :file_content => {
        quoted('cyber-dojo.sh') => ""
      },
      :file_hashes_incoming => {
        'cyber-dojo.sh' => 234234
      },
      :file_hashes_outgoing => {
        'cyber-dojo.sh' => -4545645678
      }      
    }
    
    get "diff/show", {
      :id => id,
      :avatar => avatar_name,
      :was_tag => 0,
      :now_tag => 1
    }
    assert_response :success
    
    get "diff/heartbeat", {
      :id => id,
      :avatar => avatar_name,
      :was_tag => 0,
      :now_tag => 1      
    }
  end
  
  #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  
  test "show tag_1-tag_1 (no diff) no change in any file" do
    id = checked_save_id
    kata = Kata.new(root_dir, id)    

    get 'dojo/start_json', {
      :id => id
    }
    avatar_name = json['avatar_name']    

    post '/kata/edit', {
      :id => id,
      :avatar => avatar_name
    }

    post 'kata/run_tests', {
      :id => id,
      :avatar => avatar_name,
      :file_content => {
        quoted('cyber-dojo.sh') => 'echo hello'
      },
      :file_hashes_incoming => {
        'cyber-dojo.sh' => 234234
      },
      :file_hashes_outgoing => {
        'cyber-dojo.sh' => -4545645678
      }      
    }

    get "diff/show", {
      :id => id,
      :avatar => avatar_name,
      :was_tag => 1,
      :now_tag => 1
    }
    assert_response :success
  end
  
end


{'fraction_non_alphanumeric': 0.1595878361397336, 'fraction_numerical': 0.021110831867303344, 'mean_word_length': 1.530197075651621, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4015984', 'n_tokens_mistral': 1578, 'n_tokens_neox': 1492, 'n_words': 270}