feat: enrich search with msglib display entities
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -63,7 +64,21 @@ func TestNewServerRegistersN8WinHelperToolsWithoutCallingHelper(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewServerFromEnvRejectsPartialMsgLibConfig(t *testing.T) {
|
||||
clearMsgLibEnvForServerTest(t)
|
||||
t.Setenv(EnvMsgLibSidecarExeKey, `C:\tools\MsgLibReadSidecar.exe`)
|
||||
|
||||
_, err := NewServerFromEnv()
|
||||
if err == nil {
|
||||
t.Fatal("NewServerFromEnv returned nil error for partial MsgLib config")
|
||||
}
|
||||
if !strings.Contains(err.Error(), EnvMsgLibSQLiteDLLKey) || !strings.Contains(err.Error(), EnvMsgLibDBKey) {
|
||||
t.Fatalf("error = %v, want missing MsgLib env context", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewServerFromEnvUsesPacketLogFile(t *testing.T) {
|
||||
clearMsgLibEnvForServerTest(t)
|
||||
plaintext := `--------------------------------------------------------------------------------------------------------------------------------------------
|
||||
2026/7/7 15:30:07
|
||||
<message id="msg-env-1" from="sender@imopenfire1-lanzhou/imp_pc_4.1.2.6842" to="receiver@imopenfire1-lanzhou" type="chat">
|
||||
@@ -128,6 +143,7 @@ func TestNewServerFromEnvUsesPacketLogFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewServerFromEnvUsesPacketLogDirectory(t *testing.T) {
|
||||
clearMsgLibEnvForServerTest(t)
|
||||
plaintext := `--------------------------------------------------------------------------------------------------------------------------------------------
|
||||
2026/7/7 15:30:07
|
||||
<message id="msg-dir-1" from="sender@imopenfire1-lanzhou/imp_pc_4.1.2.6842" to="receiver@imopenfire1-lanzhou" type="chat">
|
||||
@@ -181,6 +197,14 @@ func TestNewServerFromEnvUsesPacketLogDirectory(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func clearMsgLibEnvForServerTest(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Setenv(EnvMsgLibSidecarExeKey, "")
|
||||
t.Setenv(EnvMsgLibSQLiteDLLKey, "")
|
||||
t.Setenv(EnvMsgLibDBKey, "")
|
||||
t.Setenv("ISPHERE_MSGLIB_PASSWORD", "")
|
||||
}
|
||||
|
||||
func writeEncryptedPacketLogDirectoryForServerTest(t *testing.T, plaintext string) string {
|
||||
t.Helper()
|
||||
dir := t.TempDir()
|
||||
|
||||
Reference in New Issue
Block a user