Remove unused second part of the expiry counter

This commit is contained in:
2026-09-13 09:43:08 +02:00
parent 26186ac738
commit 94fd2aa143
4 changed files with 66 additions and 4 deletions
+26
View File
@@ -1686,6 +1686,32 @@ func TestCustomNameFieldIsAlwaysUsable(t *testing.T) {
}
}
// The share page's expiry line is rounded to the minute, so it must not offer
// a seconds tail it is not counting - nor, when the remainder rounds away to
// nothing, claim the file is kept forever.
func TestDescribeExpiryReadsAsWritten(t *testing.T) {
at := func(d time.Duration) *time.Time {
when := clock.Add(d)
return &when
}
for _, c := range []struct {
name string
in *time.Time
want string
}{
{"no deadline", nil, "never"},
{"already gone", at(-time.Hour), "expired"},
{"about to go", at(20 * time.Second), "(in under a minute)"},
{"a minute off", at(time.Minute), "(in 1m)"},
{"an hour and a half", at(90 * time.Minute), "(in 1h30m)"},
{"three days", at(72 * time.Hour), "(in 3d)"},
} {
if got := describeExpiry(c.in, clock); !strings.Contains(got, c.want) {
t.Errorf("%s: describeExpiry = %q, want it to contain %q", c.name, got, c.want)
}
}
}
// A chosen passphrase has to work everywhere a generated token does: at the
// login form, on an upload, and as a session.
func TestChosenPassphraseWorksEndToEnd(t *testing.T) {