Files
filebrowser/backend/internal/database/share/update_test.go
T
+10 3c02eedca6 Beta/v2.0.0 (#2746)
Co-authored-by: Kevin B. <kurami32_kbm@proton.me>
Co-authored-by: Gabriel Górski <me@glaeqen.eu>
Co-authored-by: Joel Godfrey <82655889+BaccanoMob@users.noreply.github.com>
Co-authored-by: Shane Chiu <71911511+pwn2ooown@users.noreply.github.com>
Co-authored-by: carloda <35763669+carloda@users.noreply.github.com>
Co-authored-by: Taufik Hidayat <taufikdev88@gmail.com>
Co-authored-by: Stephan Paternotte <Stephan-P@users.noreply.github.com>
Co-authored-by: SIDDHU SINGH <siddhu3116@gmail.com>
Co-authored-by: Gaurav Kalal <117557391+Gorupa@users.noreply.github.com>
Co-authored-by: Nebula <40148908+nebula-it@users.noreply.github.com>
Co-authored-by: Juan Soler <juansoler@gmail.com>
Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com>
Co-authored-by: Anatolii Prylutskyi <anpryl@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Graham Steffaniak <graham@debian-lake.ghome.net>
Co-authored-by: Neil <kylelzzz02@icloud.com>
Co-authored-by: Graham <info@quantumx-apps.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 16:24:38 -05:00

45 lines
1.0 KiB
Go

package share
import "testing"
func TestApplyPostBodyUpdateCopiesShareFrontendFields(t *testing.T) {
link := &Share{
ShareSettings: ShareSettings{
ShareLimits: ShareLimits{
MaxBandwidth: 99,
},
},
}
req := SharePostBody{
ShareEditable: ShareEditable{
ShareLimits: ShareLimits{
MaxBandwidth: 512,
DownloadsLimit: 3,
HideFileExt: ".tmp",
},
FrontendShareInfo: FrontendShareInfo{
ShareTheme: "dark",
Title: "updated",
},
},
}
ApplyPostBodyUpdate(link, &req, 12345)
if link.MaxBandwidth != 512 {
t.Fatalf("MaxBandwidth: got %d want 512", link.MaxBandwidth)
}
if link.DownloadsLimit != 3 {
t.Fatalf("DownloadsLimit: got %d want 3", link.DownloadsLimit)
}
if link.HideFileExt != ".tmp" {
t.Fatalf("HideFileExt: got %q want .tmp", link.HideFileExt)
}
if link.ShareTheme != "dark" || link.Title != "updated" {
t.Fatalf("FrontendShareInfo not applied: %#v", link.FrontendShareInfo)
}
if link.Expire != 12345 {
t.Fatalf("Expire: got %d want 12345", link.Expire)
}
}