mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 11:42:24 -05:00
[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:
parent
21a101ebc4
commit
9114c5ca1b
7 changed files with 247 additions and 137 deletions
|
|
@ -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),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue