Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaoz committed Aug 19, 2023
1 parent a6b4f98 commit 7cc7c44
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions worker/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,8 +891,7 @@ func (suite *WorkerTestSuite) TestRankByClickTroughRate() {
itemCache.Set(strconv.Itoa(i), data.Item{ItemId: strconv.Itoa(i)})
}
// rank items
suite.ClickModel = new(mockFactorizationMachine)
result, err := suite.rankByClickTroughRate(&data.User{UserId: "1"}, [][]string{{"1", "2", "3", "4", "5"}}, itemCache, suite.ClickModel)
result, err := suite.rankByClickTroughRate(&data.User{UserId: "1"}, [][]string{{"1", "2", "3", "4", "5"}}, itemCache, new(mockFactorizationMachine))
suite.NoError(err)
suite.Equal([]string{"5", "4", "3", "2", "1"}, lo.Map(result, func(d cache.Document, _ int) string {
return d.Id
Expand Down Expand Up @@ -924,7 +923,7 @@ func (suite *WorkerTestSuite) TestReplacement_ClickThroughRate() {
{FeedbackKey: data.FeedbackKey{FeedbackType: "i", UserId: "0", ItemId: "8"}},
}, true, false, true)
suite.NoError(err)
suite.ClickModel = new(mockFactorizationMachine)
suite.rankers = []click.FactorizationMachine{new(mockFactorizationMachine)}
suite.Recommend([]data.User{{UserId: "0"}})
// read recommend time
recommendTime, err := suite.CacheClient.Get(ctx, cache.Key(cache.LastUpdateUserRecommendTime, "0")).Time()
Expand Down

0 comments on commit 7cc7c44

Please sign in to comment.