package feishu

import (
	"fmt"
	"poc-daily-report/pkg/model"
	"testing"

	"github.com/spf13/viper"
)

func testSetUp() {
	viper.Set("scope", "prod")
	viper.SetConfigName("conf")         // name of config file (without extension)
	viper.SetConfigType("yaml")         // REQUIRED if the config file does not have the extension in the name
	viper.AddConfigPath("../../config") // optionally look for config in the working directory
	err := viper.ReadInConfig()         // Find and read the config file
	if err != nil {                     // Handle errors reading the config file
		panic(fmt.Errorf("Fatal error config file: %w \n", err))
	}
}

func TestSendingMessage(t *testing.T) {
	testSetUp()
	SendMessageToInternalReportChat("hello world")
}

func TestSendingCard(t *testing.T) {
	testSetUp()
	SendCardToInternalReportChat(model.FeishuCardParams{Title: "A Message for Testing", Color: "red", Text: "**Hello World**"})
}
