Files
online-backend/internal/backup/service_test.go
GuwandykA 28509eb4ca
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled
Add backups, currencies and dashboard APIs, and scope access by guard_name.
Web users may only CRUD their own records, operators stay in assigned branches, and admin/manager/superadmin keep full access.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-31 18:14:47 +05:00

25 lines
572 B
Go

package backup
import "testing"
func TestValidBackupFileName(t *testing.T) {
tests := []struct {
name string
ok bool
}{
{"backup_2026_05_22_01.sql", true},
{"backup_2026_08_29_12.sql", true},
{"", false},
{"../etc/passwd", false},
{"backup_2026_05_22_01.sql/../../x", false},
{"foo.sql", false},
{"backup_2026_05_22_01.sql.exe", false},
{"backup_2026_05_22_01.sql ", false},
}
for _, tt := range tests {
if got := validBackupFileName(tt.name); got != tt.ok {
t.Errorf("validBackupFileName(%q) = %v, want %v", tt.name, got, tt.ok)
}
}
}