diff options
| author | 2023-04-06 13:43:13 +0200 | |
|---|---|---|
| committer | 2023-04-06 12:43:13 +0100 | |
| commit | 3510454768b1877540c6dc25f4967e4b608203a8 (patch) | |
| tree | aed9c913711f08ae748591271132f968ef1e716f /internal/db/bundb/timeline_test.go | |
| parent | [bugfix] Normalize status content (don't parse status content as IRI) (#1665) (diff) | |
| download | gotosocial-3510454768b1877540c6dc25f4967e4b608203a8.tar.xz | |
[bugfix/chore] Refactor timeline code (#1656)
* start poking timelines
* OK yes we're refactoring, but it's nothing like the last time so don't worry
* more fiddling
* update tests, simplify Get
* thanks linter, you're the best, mwah mwah kisses
* do a bit more tidying up
* start buggering about with the prepare function
* fix little oopsie
* start merging lists into 1
* ik heb een heel zwaar leven
nee nee echt waar
* hey it works we did it reddit
* regenerate swagger docs
* tidy up a wee bit
* adjust paging
* fix little error, remove unused functions
Diffstat (limited to 'internal/db/bundb/timeline_test.go')
| -rw-r--r-- | internal/db/bundb/timeline_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/db/bundb/timeline_test.go b/internal/db/bundb/timeline_test.go index d6632b38c..f954c78dd 100644 --- a/internal/db/bundb/timeline_test.go +++ b/internal/db/bundb/timeline_test.go @@ -100,6 +100,32 @@ func (suite *TimelineTestSuite) TestGetHomeTimelineWithFutureStatus() { suite.Len(s, 16) } +func (suite *TimelineTestSuite) TestGetHomeTimelineBackToFront() { + ctx := context.Background() + + viewingAccount := suite.testAccounts["local_account_1"] + + s, err := suite.db.GetHomeTimeline(ctx, viewingAccount.ID, "", "", id.Lowest, 5, false) + suite.NoError(err) + + suite.Len(s, 5) + suite.Equal("01F8MHAYFKS4KMXF8K5Y1C0KRN", s[0].ID) + suite.Equal("01F8MH75CBF9JFX4ZAD54N0W0R", s[len(s)-1].ID) +} + +func (suite *TimelineTestSuite) TestGetHomeTimelineFromHighest() { + ctx := context.Background() + + viewingAccount := suite.testAccounts["local_account_1"] + + s, err := suite.db.GetHomeTimeline(ctx, viewingAccount.ID, id.Highest, "", "", 5, false) + suite.NoError(err) + + suite.Len(s, 5) + suite.Equal("01G36SF3V6Y6V5BF9P4R7PQG7G", s[0].ID) + suite.Equal("01FCTA44PW9H1TB328S9AQXKDS", s[len(s)-1].ID) +} + func getFutureStatus() *gtsmodel.Status { theDistantFuture := time.Now().Add(876600 * time.Hour) id, err := id.NewULIDFromTime(theDistantFuture) |
