@@ -254,3 +254,49 @@ func TestInstanceSettingListAll(t *testing.T) {
254254
255255 ts .Close ()
256256}
257+
258+ func TestInstanceSettingEdgeCases (t * testing.T ) {
259+ t .Parallel ()
260+ ctx := context .Background ()
261+ ts := NewTestingStore (ctx , t )
262+
263+ // Case 1: General Setting with special characters and Unicode
264+ specialScript := `<script>alert("你好"); var x = 'test\'s';</script>`
265+ specialStyle := `body { font-family: "Noto Sans SC", sans-serif; content: "\u2764"; }`
266+ _ , err := ts .UpsertInstanceSetting (ctx , & storepb.InstanceSetting {
267+ Key : storepb .InstanceSettingKey_GENERAL ,
268+ Value : & storepb.InstanceSetting_GeneralSetting {
269+ GeneralSetting : & storepb.InstanceGeneralSetting {
270+ AdditionalScript : specialScript ,
271+ AdditionalStyle : specialStyle ,
272+ },
273+ },
274+ })
275+ require .NoError (t , err )
276+
277+ generalSetting , err := ts .GetInstanceGeneralSetting (ctx )
278+ require .NoError (t , err )
279+ require .Equal (t , specialScript , generalSetting .AdditionalScript )
280+ require .Equal (t , specialStyle , generalSetting .AdditionalStyle )
281+
282+ // Case 2: Memo Related Setting with Unicode reactions
283+ unicodeReactions := []string {"🐱" , "🐶" , "🦊" , "🦄" }
284+ _ , err = ts .UpsertInstanceSetting (ctx , & storepb.InstanceSetting {
285+ Key : storepb .InstanceSettingKey_MEMO_RELATED ,
286+ Value : & storepb.InstanceSetting_MemoRelatedSetting {
287+ MemoRelatedSetting : & storepb.InstanceMemoRelatedSetting {
288+ ContentLengthLimit : 1000 ,
289+ Reactions : unicodeReactions ,
290+ },
291+ },
292+ })
293+ require .NoError (t , err )
294+
295+ memoSetting , err := ts .GetInstanceMemoRelatedSetting (ctx )
296+ require .NoError (t , err )
297+ require .Equal (t , unicodeReactions , memoSetting .Reactions )
298+
299+ ts .Close ()
300+ }
301+
302+
0 commit comments