package tests

import (
	"github.com/stretchr/testify/assert"
	"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
	"penahub.gitlab.yandexcloud.net/backend/quiz/worker/senders"
	"testing"
	"time"
)

func Test_Tg_Sender(t *testing.T) {
	tg_Sender, err := senders.NewTgSender("6712573453:AAFqTOsgwe_j48ZQ1GzWKQDT5Nwr-SAWjz8")
	assert.NoError(t, err)
	err = tg_Sender.SendLead(senders.LeadData{
		To:       int64(-1002217604546),
		Subject:  "test_TG_Sender",
		Template: tgClientTemplate,
		TemplateData: senders.TemplateData{
			QuizConfig: model.ResultInfo{
				Theme: "Taemplste Quiz",
			},
			AnswerContent: model.ResultContent{
				Name:  "Pasha",
				Phone: "+723456789",
				Email: "test@example.com",
				//Adress:    "chtoto tam",
				Telegram:  "@test",
				Wechat:    "test_wechat",
				Viber:     "+723456789",
				Vk:        "test_vk",
				Skype:     "test_skype",
				Whatsup:   "test_whatsup",
				Messenger: "test_messenger",
			},
			AllAnswers: []model.ResultAnswer{
				{AnswerID: 1, QuestionID: 1, Content: "Pasha", CreatedAt: time.Now()},
				{AnswerID: 2, QuestionID: 2, Content: "From a friend", CreatedAt: time.Now()},
			},
			QuestionsMap: map[uint64]string{
				1: "How did you hear about us?",
				2: "How did you hear about us?",
			},
			AnswerTime: time.Now().Format("Monday, 2 January 2006 г., 15:04 UTC-07:00"),
		},
	})

	assert.NoError(t, err)
}
