Files
eminuxCRM/test/services/campaign_import_matchlivetv_launch_test.rb
T
eminuxandCursor c4e5f289cf
CI / scan_ruby (push) Failing after 11m20s
CI / scan_js (push) Successful in 10m35s
CI / lint (push) Has been cancelled
Commit iniziale di eminuxCRM: CRM Rails con pipeline, campagne email e Docker.
Include autenticazione, progetti isolati, mail marketing HTML con SMTP, test A/B e editor WYSIWYG.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 23:01:48 +02:00

52 lines
2.4 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
require "test_helper"
require "tempfile"
class CampaignImportMatchlivetvLaunchTest < ActiveSupport::TestCase
test "imports campaign rows onto MatchLiveTV" do
csv = Tempfile.new(["campagna", ".csv"])
csv.write(<<~CSV)
N.,Regione,Prov.,Società,M/F,Email verificata,Sito / profilo,Streaming rilevato,Evidenza / fit commerciale,Test A/B,Stato invio,Data invio,Esito,Demo / Trial,Conversione,Piano,Fonte contatto / ricerca,Data verifica,Note follow-up
1,Piemonte,TO,Vol-Ley Academy Volpiano,F,volley.academy.to@gmail.com,https://www.facebook.com/p/Vol-Ley-Academy-100063526780569/,NON RILEVATO,Academy giovanile,A,DA INVIARE,,,NO,NO,,https://example.com/fonte,2026-08-17,
7,Lombardia,MB,Volley Brianza Est,F,ds@volleybrianzaest.it,https://www.volleybrianzaest.it/, / PARZIALE,U16/U18 nazionale,A,DA INVIARE,,,NO,NO,,https://www.volleybrianzaest.it/,46251,
100,Valle d'Aosta,AO,Cogne Aosta Volley,F,cogneaostavolley@gmail.com,https://www.youtube.com/@CogneAostaVolley, SPORTCAM,Vivaio prolifico,B,DA INVIARE,,,NO,NO,,https://www.fipav-vda.com/societa,2026-08-17,
CSV
csv.flush
result = CampaignImport::MatchlivetvLaunch.new(
path: csv.path,
user: users(:admin),
project: projects(:matchlivetv),
wipe: false
).call
assert_empty result.errors, result.errors.inspect
assert_equal 3, result.imported
org = Organization.find_by!(name: "Vol-Ley Academy Volpiano")
assert_equal "female", org.team_gender
assert_equal "not_detected", org.streaming_status
assert_equal 1, org.list_position
assert_equal Date.new(2026, 8, 17), org.verified_at
assert_equal "campaign", org.lead_source
assert org.projects.exists?(code: "matchlivetv")
assert_equal "volley.academy.to@gmail.com", org.contacts.primary_first.first.email
opp = org.campaign_opportunity(projects(:matchlivetv))
assert_equal "A", opp.ab_variant
assert_equal "to_send", opp.send_status
assert_equal "to_contact", opp.pipeline_stage
assert_not opp.demo_trial
assert_not opp.converted
brianza = Organization.find_by!(name: "Volley Brianza Est")
assert_equal "yes_partial", brianza.streaming_status
assert_equal Date.new(2026, 8, 17), brianza.verified_at
cogne = Organization.find_by!(name: "Cogne Aosta Volley")
assert_equal "yes_sportcam", cogne.streaming_status
assert_equal "B", cogne.campaign_opportunity(projects(:matchlivetv)).ab_variant
ensure
csv.close!
end
end