From 9114c5ca1bff8ebbe3d2d20d873f8f5b7a78be43 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sat, 21 Oct 2023 17:23:05 +0200 Subject: [bugfix/frontend] fix typo and other oddness in patchRemoteEmojis (#2281) * fix emoji test model * found the bug! * remove unused 'current' import * comment useChecklistReducer * wah * lint * fix cleaner tests --- internal/cleaner/emoji_test.go | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'internal/cleaner/emoji_test.go') diff --git a/internal/cleaner/emoji_test.go b/internal/cleaner/emoji_test.go index 81fde6e48..30642a818 100644 --- a/internal/cleaner/emoji_test.go +++ b/internal/cleaner/emoji_test.go @@ -9,8 +9,21 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtscontext" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" + "github.com/superseriousbusiness/gotosocial/internal/util" ) +func copyMap(in map[string]*gtsmodel.Emoji) map[string]*gtsmodel.Emoji { + out := make(map[string]*gtsmodel.Emoji, len(in)) + + for k, v1 := range in { + v2 := new(gtsmodel.Emoji) + *v2 = *v1 + out[k] = v2 + } + + return out +} + func (suite *CleanerTestSuite) TestEmojiUncacheRemote() { suite.testEmojiUncacheRemote( context.Background(), @@ -54,16 +67,28 @@ func (suite *CleanerTestSuite) TestEmojiPruneUnusedDryRun() { } func (suite *CleanerTestSuite) TestEmojiFixCacheStates() { + // Copy testrig emojis + mark + // rainbow emoji as uncached + // so there's something to fix. + emojis := copyMap(suite.emojis) + emojis["rainbow"].Cached = util.Ptr(false) + suite.testEmojiFixCacheStates( context.Background(), - mapvals(suite.emojis), + mapvals(emojis), ) } func (suite *CleanerTestSuite) TestEmojiFixCacheStatesDryRun() { + // Copy testrig emojis + mark + // rainbow emoji as uncached + // so there's something to fix. + emojis := copyMap(suite.emojis) + emojis["rainbow"].Cached = util.Ptr(false) + suite.testEmojiFixCacheStates( gtscontext.SetDryRun(context.Background()), - mapvals(suite.emojis), + mapvals(emojis), ) } -- cgit v1.2.3