diff options
author | 2023-10-21 17:23:05 +0200 | |
---|---|---|
committer | 2023-10-21 17:23:05 +0200 | |
commit | 9114c5ca1bff8ebbe3d2d20d873f8f5b7a78be43 (patch) | |
tree | e1afdb23900f6141c5befbb5b21905a240c60482 /internal/cleaner | |
parent | [docs] Update README.md (#2279) (diff) | |
download | gotosocial-9114c5ca1bff8ebbe3d2d20d873f8f5b7a78be43.tar.xz |
[bugfix/frontend] fix typo and other oddness in patchRemoteEmojis (#2281)v0.12.0
* fix emoji test model
* found the bug!
* remove unused 'current' import
* comment useChecklistReducer
* wah
* lint
* fix cleaner tests
Diffstat (limited to 'internal/cleaner')
-rw-r--r-- | internal/cleaner/emoji_test.go | 29 |
1 files changed, 27 insertions, 2 deletions
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), ) } |