<commit_before>require 'test_helper'

class GroupAssignmentArchiveTest < ActiveSupport::TestCase
  test 'change_period_start_creates_log' do
    group_assignment = create :group_assignment, period_start: 100.days.ago, period_end: nil
    assert group_assignment.group_assignment_logs.size.zero?
    group_assignment.update(period_start: 50.days.ago)
    group_assignment.reload
    assert_equal group_assignment, group_assignment.group_assignment_logs.first.group_assignment
  end

  test 'set_period_end_creates_log' do
    group_assignment = create :group_assignment, period_start: 100.days.ago, period_end: nil
    assert group_assignment.group_assignment_logs.size.zero?
    group_assignment.update(period_end: 2.days.ago)
    group_assignment.reload
    assert_equal group_assignment, group_assignment.group_assignment_logs.first.group_assignment
  end

  test 'terminateing_group_assignment_creates_log_and_deletes_self' do
    superadmin = create :user
    group_assignment = create :group_assignment, period_start: 100.days.ago, period_end: 3.days.ago,
      period_end_set_by: superadmin, termination_submitted_at: 2.days.ago,
      termination_submitted_by: superadmin
    assert group_assignment.group_assignment_logs.size.zero?
    group_assignment.update(termination_verified_at: Time.zone.now,
      termination_verified_by: superadmin)
    group_assignment.reload<commit_msg>fix typo in test name<commit_after>require 'test_helper'

class GroupAssignmentArchiveTest < ActiveSupport::TestCase
  test 'change_period_start_creates_log' do
    group_assignment = create :group_assignment, period_start: 100.days.ago, period_end: nil
    assert group_assignment.group_assignment_logs.size.zero?
    group_assignment.update(period_start: 50.days.ago)
    group_assignment.reload
    assert_equal group_assignment, group_assignment.group_assignment_logs.first.group_assignment
  end

  test 'set_period_end_creates_log' do
    group_assignment = create :group_assignment, period_start: 100.days.ago, period_end: nil
    assert group_assignment.group_assignment_logs.size.zero?
    group_assignment.update(period_end: 2.days.ago)
    group_assignment.reload
    assert_equal group_assignment, group_assignment.group_assignment_logs.first.group_assignment
  end

  test 'terminating_group_assignment_creates_log_and_deletes_self' do
    superadmin = create :user
    group_assignment = create :group_assignment, period_start: 100.days.ago, period_end: 3.days.ago,
      period_end_set_by: superadmin, termination_submitted_at: 2.days.ago,
      termination_submitted_by: superadmin
    assert group_assignment.group_assignment_logs.size.zero?
    group_assignment.update(termination_verified_at: Time.zone.now,
      termination_verified_by: superadmin)
    group_assignment.reload
{'fraction_non_alphanumeric': 0.06673842841765339, 'fraction_numerical': 0.010046645138141371, 'mean_word_length': 5.85012285012285, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2757196', 'n_tokens_mistral': 921, 'n_tokens_neox': 878, 'n_words': 141}