<commit_before>require 'test_helper'

class TeamTest < ActiveSupport::TestCase
  test "total shares should be the sum of all shares for a team" do
    team = FactoryGirl.create(:team)
    share1 = FactoryGirl.create(:share, team: team)
    share2 = FactoryGirl.create(:share, team: team)
    
    assert_equal share1.shares + share2.shares, team.total_shares
  end

  test "total shares should be zero if nobody selected the team" do
    team = FactoryGirl.create(:team)
    
    assert_equal 0, team.total_shares
  end

  test "share percentage should be the percentage of shares for a team" do
    user = FactoryGirl.create(:user, starting_shares: 200)
    team = FactoryGirl.create(:team)
    share1 = FactoryGirl.create(:share, team: team, user: user, shares: 50)
    share2 = FactoryGirl.create(:share, team: team, user: user, shares: 50)
    
    assert_equal (team.total_shares * 100).to_f / User.total_shares_invested, team.share_percentage
  end

  test "share percentage should be zero if nobody selected the team" do
    FactoryGirl.create(:user, starting_shares: 200)
    team = FactoryGirl.create(:team)
    
    assert_equal 0, team.share_percentage
  end
end
# == Schema Information
#
# Table name: teams
#
#  id         :integer(4)      not null, primary key
#  match_id   :integer(4)
#  name       :string(255)     not null
#  winner     :boolean(1)      default(FALSE)
#  created_at :datetime        not null
#  updated_at :datetime        not null
#

<commit_msg>Cosmetic test update<commit_after>require 'test_helper'

class TeamTest < ActiveSupport::TestCase
  test "total shares should be the sum of all shares for a team" do
    team = FactoryGirl.create(:team)
    share1 = FactoryGirl.create(:share, team: team)
    share2 = FactoryGirl.create(:share, team: team)
    
    assert_equal share1.shares + share2.shares, team.total_shares
  end

  test "total shares should be zero if nobody selected the team" do
    team = FactoryGirl.create(:team)
    
    assert_equal 0, team.total_shares
  end

  test "share percentage should be the percentage of shares for a team" do
    user = FactoryGirl.create(:user, starting_shares: 200)
    team = FactoryGirl.create(:team)
    share1 = FactoryGirl.create(:share, team: team, user: user, shares: 50)
    share2 = FactoryGirl.create(:share, team: team, user: user, shares: 50)
    calculated_percentage = (team.total_shares * 100).to_f / User.total_shares_invested
    
    assert_equal calculated_percentage, team.share_percentage
  end

  test "share percentage should be zero if nobody selected the team" do
    FactoryGirl.create(:user, starting_shares: 200)
    team = FactoryGirl.create(:team)
    
    assert_equal 0, team.share_percentage
  end
end
# == Schema Information
#
# Table name: teams
#
#  id         :integer(4)      not null, primary key
#  match_id   :integer(4)
#  name       :string(255)     not null
#  winner     :boolean(1)      default(FALSE)
#  created_at :datetime        not null
#  updated_at :datetime        not null
#


{'fraction_non_alphanumeric': 0.08904336312479312, 'fraction_numerical': 0.01787487586891758, 'mean_word_length': 3.3924418604651163, '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': '3791260', 'n_tokens_mistral': 982, 'n_tokens_neox': 921, 'n_words': 290}