describe "DataHelpers::AudioBulkUploadHelper" do
  # OK to pass nil to constructor because we don't care about @template_url in this test
  subject { DataHelpers::AudioBulkUploadHelper }

  context "#rows_in_final_spreadsheet" do
    it "should return 0 for an empty hash" do
      expect(subject.rows_in_final_spreadsheet({})).to eq 0
    end

    it "should return 0 for a hash with only nil values" do
      expect(subject.rows_in_final_spreadsheet("header1" => nil)).to eq 0
    end

    it "should return 1 for a hash with only string values" do
      fixture = {
        "header1" => "str",
        "header2" => "str also"
      }
      expect(subject.rows_in_final_spreadsheet(fixture)).to eq 1
    end

    it "should return 1 for a hash with a max array value size of 1" do
      expect(subject.rows_in_final_spreadsheet("header1" => ["str"])).to eq 1
    end

    it "should work for a hash with a mix of array and string values" do
      fixture = {
        "header0" => "str",
        "header1" => ["str"],
        "header2" => ["str", "str 2"]
      }
      expect(subject.rows_in_final_spreadsheet(fixture)).to eq 2
    end
  end
end
