mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 22:06:38 +08:00
df7ad453cc
Unknown values such as http and inproc_cron made the admin UI call t(undefined). Dispatch sites now write system/manual/retry/schedule, the list API maps legacy rows, and the table skips missing i18n keys.
33 lines
943 B
Go
33 lines
943 B
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package service
|
|
|
|
import (
|
|
"Wavelet/core/contracts"
|
|
"testing"
|
|
)
|
|
|
|
func TestNormalizeTaskTrigger(t *testing.T) {
|
|
tests := []struct {
|
|
in string
|
|
want string
|
|
}{
|
|
{in: contracts.TaskTriggerManual, want: contracts.TaskTriggerManual},
|
|
{in: contracts.TaskTriggerSystem, want: contracts.TaskTriggerSystem},
|
|
{in: contracts.TaskTriggerRetry, want: contracts.TaskTriggerRetry},
|
|
{in: contracts.TaskTriggerSchedule, want: contracts.TaskTriggerSchedule},
|
|
{in: "http", want: contracts.TaskTriggerSystem},
|
|
{in: "inproc_cron", want: contracts.TaskTriggerSchedule},
|
|
{in: "cron", want: contracts.TaskTriggerSchedule},
|
|
{in: "", want: contracts.TaskTriggerSystem},
|
|
{in: "custom", want: "custom"},
|
|
}
|
|
for _, tt := range tests {
|
|
got := normalizeTaskTrigger(tt.in)
|
|
if got != tt.want {
|
|
t.Errorf("normalizeTaskTrigger(%q) = %q, want %q", tt.in, got, tt.want)
|
|
}
|
|
}
|
|
}
|