Files
VoCat/internal/server/call_api_test.go
T
MengMengCode 9fc3f1c5b8 feat: add Telegram API URL handling and version comparison utilities
- Implemented `telegramAPIURL` and `validateTelegramAPIURL` functions for constructing and validating Telegram API URLs.
- Added semantic versioning utilities in `version.go` to compare versions and validate semantic version formats.
- Created tests for version comparison logic in `version_test.go`.
- Introduced IMS call handling in `call_runtime.go`, including methods for dialing, answering, and hanging up calls.
- Added tests for incoming call handling and validation in `call_runtime_test.go`.
- Developed a new `PluginsCard` component for managing plugins via URL or file upload in the web interface.
- Implemented plugin management functions in `extensions.ts` and created an `ExtensionPage` for displaying plugin contributions.
2026-08-09 19:28:12 +08:00

31 lines
719 B
Go

package server
import (
"testing"
"vocat/internal/modem"
)
func TestParseCLCC(t *testing.T) {
calls := parseCLCC(modem.Response{Lines: []string{
`+CLCC: 1,1,4,0,0,"+447700900000",145`,
`+CLCC: 2,0,0,0,0,"12345",129`,
}})
if len(calls) != 2 || calls[0]["number"] != "+447700900000" || calls[1]["state"] != 0 {
t.Fatalf("parseCLCC = %#v", calls)
}
}
func TestValidDialNumber(t *testing.T) {
for _, value := range []string{"+447700900000", "12345", "*100#"} {
if !validDialNumber(value) {
t.Errorf("validDialNumber(%q) = false", value)
}
}
for _, value := range []string{"", "+", "12;ATH", "12 34", "abc"} {
if validDialNumber(value) {
t.Errorf("validDialNumber(%q) = true", value)
}
}
}