Merge 74 upstream commits. Key changes: - API key failover, ModeMarkdownV2, SpawnStatusTool - macOS systray, SecureStore encryption - Environment variable constants consolidation - Cron event-driven refactor, web frontend refactor - Action version updates (v4→v6, v3→v4) Conflict resolution: kept fork architecture (LLM worker queue, plan mode, orchestration, worktrees) + integrated upstream's new features (SenderID/DisplayName, allowPaths, native search, HTTP server, exit code extraction). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
68 lines
1.3 KiB
Go
68 lines
1.3 KiB
Go
package telegram
|
|
|
|
import (
|
|
_ "embed"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
//go:embed testdata/md2_all_formats.txt
|
|
var md2AllFormats string
|
|
|
|
func Test_markdownToTelegramMarkdownV2(t *testing.T) {
|
|
cases := []struct {
|
|
name string
|
|
input string
|
|
expected string
|
|
}{
|
|
{
|
|
name: "heading -> bolding",
|
|
input: `## HeadingH2 #`,
|
|
expected: "*HeadingH2 \\#*",
|
|
},
|
|
{
|
|
name: "strikethrough",
|
|
input: "~strikethroughMD~",
|
|
expected: "~strikethroughMD~",
|
|
},
|
|
{
|
|
name: "inline URL",
|
|
input: "[inline URL](http://www.example.com/)",
|
|
expected: "[inline URL](http://www.example.com/)",
|
|
},
|
|
{
|
|
name: "all telegram formats",
|
|
input: md2AllFormats,
|
|
expected: md2AllFormats,
|
|
},
|
|
{
|
|
name: "empty",
|
|
input: "",
|
|
expected: "",
|
|
},
|
|
{
|
|
name: "one letter",
|
|
input: "o",
|
|
expected: "o",
|
|
},
|
|
{
|
|
name: "",
|
|
input: "*Last update: ~10 24h*",
|
|
expected: "*Last update: \\~10 24h*",
|
|
},
|
|
{
|
|
name: "",
|
|
input: "<Market Capitalization>",
|
|
expected: "\\<Market Capitalization\\>",
|
|
},
|
|
}
|
|
|
|
for _, tc := range cases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
actual := markdownToTelegramMarkdownV2(tc.input)
|
|
|
|
require.EqualValues(t, tc.expected, actual)
|
|
})
|
|
}
|
|
}
|