<commit_before>require_relative 'app_controller_test_base'

class ForkerControllerTest < AppControllerTestBase

  # This test (3E99D85BF) depends on the languages start-point being complete.

=begin
  test '3E99D85BF',
  'when language has been renamed and everything else',
  'is ok then fork works and the new dojos id is returned' do
    language = languages['C#-NUnit']
    manifest = language.create_kata_manifest
    manifest['language'] = 'C#' # old-name
    katas.create_kata(manifest)
    @id = manifest['id']
    @avatar = start # 0
    run_tests       # 1
    fork(@id, @avatar.name, tag=1)
    assert forked?
  end
=end

  # - - - - - - - - - - - - - - - - - - - - - - - - - - -

  test '3E9892AFE',
  'when id is invalid then fork fails and the reason given is dojo' do
    fork(bad_id = 'bad-id', 'hippo', tag=1)
    refute forked?
    assert_reason_is("dojo(#{bad_id})")
    assert_nil forked_kata_id
  end

  # - - - - - - - - - - - - - - - - - - - - - - - - - - -

  test '3E967725B',
  'when avatar not started, the fork fails, and the reason given is avatar' do
    id = create_kata
    fork(id, bad_avatar = 'hippo', tag=1)
    refute forked?
    assert_reason_is("avatar(#{bad_avatar})")
    assert_nil forked_kata_id
  end

  # - - - - - - - - - - - - - - - - - - - - - - - - - - -

  test '3E94CCCA7',
  'when tag is bad, the fork fails, and the reason given is traffic_light' do
    @id = create_kata
    @avatar = start
    bad_tag_test('xx')      # !is_tag
    bad_tag_test('-14')     # tag <= 0
    bad_tag_test('-1')      # tag <= 0
    bad_tag_test('0')       # tag <= 0
    run_tests
    bad_tag_test('2')       # tag > avatar.lights.length
  end
<commit_msg>fix out-of-date test; tag==-1 now a fork feature<commit_after>require_relative 'app_controller_test_base'

class ForkerControllerTest < AppControllerTestBase

  # This test (3E99D85BF) depends on the languages start-point being complete.

=begin
  test '3E99D85BF',
  'when language has been renamed and everything else',
  'is ok then fork works and the new dojos id is returned' do
    language = languages['C#-NUnit']
    manifest = language.create_kata_manifest
    manifest['language'] = 'C#' # old-name
    katas.create_kata(manifest)
    @id = manifest['id']
    @avatar = start # 0
    run_tests       # 1
    fork(@id, @avatar.name, tag=1)
    assert forked?
  end
=end

  # - - - - - - - - - - - - - - - - - - - - - - - - - - -

  test '3E9892AFE',
  'when id is invalid then fork fails and the reason given is dojo' do
    fork(bad_id = 'bad-id', 'hippo', tag=1)
    refute forked?
    assert_reason_is("dojo(#{bad_id})")
    assert_nil forked_kata_id
  end

  # - - - - - - - - - - - - - - - - - - - - - - - - - - -

  test '3E967725B',
  'when avatar not started, the fork fails, and the reason given is avatar' do
    id = create_kata
    fork(id, bad_avatar = 'hippo', tag=1)
    refute forked?
    assert_reason_is("avatar(#{bad_avatar})")
    assert_nil forked_kata_id
  end

  # - - - - - - - - - - - - - - - - - - - - - - - - - - -

  test '3E94CCCA7',
  'when tag is bad, the fork fails, and the reason given is traffic_light' do
    @id = create_kata
    @avatar = start
    bad_tag_test('xx')      # !is_tag
    bad_tag_test('-14')     # tag <= 0
    bad_tag_test('0')       # tag <= 0
    run_tests
    bad_tag_test('2')       # tag > avatar.lights.length
  end

{'fraction_non_alphanumeric': 0.14522821576763487, 'fraction_numerical': 0.022821576763485476, 'mean_word_length': 2.1899810964083177, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7539936', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1249, 'n_words': 306}