From 0e910d733d4e3238cdbfc4b946490dc54b782491 Mon Sep 17 00:00:00 2001 From: Vyr Cossont Date: Sat, 23 Nov 2024 13:42:30 -0800 Subject: [PATCH] Additional v2 regression test --- .../api/client/filters/v2/filterput_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/internal/api/client/filters/v2/filterput_test.go b/internal/api/client/filters/v2/filterput_test.go index 4c04fa5d1..afa858ba9 100644 --- a/internal/api/client/filters/v2/filterput_test.go +++ b/internal/api/client/filters/v2/filterput_test.go @@ -394,3 +394,20 @@ func (suite *FiltersTestSuite) TestPutFilterUnsetExpirationDateNullJSON() { filter = suite.setFilterExpiration(id, nil, nil, &requestJson) suite.Nil(filter.ExpiresAt) } + +// Regression test related to https://github.com/superseriousbusiness/gotosocial/issues/3497 +func (suite *FiltersTestSuite) TestPutFilterUnalteredExpirationDateJSON() { + id := suite.testFilters["local_account_1_filter_4"].ID + + // Setup: set an expiration date for the filter. + expiresIn := 86400 + filter := suite.setFilterExpiration(id, &expiresIn, nil, nil) + if !suite.NotNil(filter.ExpiresAt) { + suite.FailNow("Test precondition failed") + } + + // Update nothing. There should still be an expiration date. + requestJson := `{}` + filter = suite.setFilterExpiration(id, nil, nil, &requestJson) + suite.NotNil(filter.ExpiresAt) +}