Files
team/server/channels/app/post_rewrite_test.go
Nick MisasiandGitHub 8ef79057c5 MM-66577 Preserve locale in rewrite prompt (#35013)
* Preserve rewrite locale in prompt

* Add license header to rewrite tests
2026-02-03 11:32:03 -05:00

29 lines
710 B
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package app
import (
"strings"
"testing"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost/server/public/model"
)
func TestBuildRewriteSystemPrompt(t *testing.T) {
basePrompt := model.RewriteSystemPrompt
t.Run("uses_user_locale", func(t *testing.T) {
prompt := buildRewriteSystemPrompt("en_CA")
require.True(t, strings.HasPrefix(prompt, basePrompt))
require.Contains(t, prompt, "User locale: en_CA.")
})
t.Run("returns_base_prompt_when_no_locale", func(t *testing.T) {
prompt := buildRewriteSystemPrompt("")
require.Equal(t, basePrompt, prompt)
})
}