[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
This commit is contained in:
tobi 2023-10-21 17:23:05 +02:00 committed by GitHub
commit 9114c5ca1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 247 additions and 137 deletions

View file

@ -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),
)
}