Skip to content

Commit

Permalink
tests in-memory comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ykkssyaa committed May 23, 2024
1 parent 1776f1f commit f2966d9
Show file tree
Hide file tree
Showing 3 changed files with 438 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sosodev/duration v1.3.1 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/urfave/cli/v2 v2.27.2 // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
golang.org/x/mod v0.17.0 // indirect
Expand Down
3 changes: 2 additions & 1 deletion internal/gateway/in-memory/comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ func (c *CommentsInMemory) GetRepliesOfComment(commentId int) ([]*models.Comment

for _, comment := range c.comments {
if comment.ReplyTo != nil && *comment.ReplyTo == commentId {
res = append(res, &comment)
com := comment
res = append(res, &com)
}
}

Expand Down
Loading

0 comments on commit f2966d9

Please sign in to comment.