mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 14:06:36 +08:00
528240026d
- make format 现在与 code-check 使用同一格式化器(golangci-lint fmt),消除 goimports -local 与 gofumpt 的格式拉锯 - .golangci.yml 关闭默认 50/3 截断,完整上报所有问题(只增强不弱化) - 全库 gofumpt 规范化(203 files, 纯格式无行为变更)
41 lines
939 B
Go
41 lines
939 B
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package admin_test
|
|
|
|
import (
|
|
"Wavelet/core"
|
|
"Wavelet/plugins/domain/admin"
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestAdminPluginUnit(t *testing.T) {
|
|
ctx := core.NewContext(context.Background())
|
|
p := admin.New()
|
|
assert.Equal(t, "admin", p.Name())
|
|
assert.Equal(t, "1.0.0", p.Manifest().Version)
|
|
require.NoError(t, p.Apply(ctx))
|
|
|
|
// Verify routes
|
|
routes := ctx.Router().Routes()
|
|
assert.NotEmpty(t, routes)
|
|
|
|
// Verify tasks
|
|
_, ok := ctx.Tasks().Get("admin:system_cleanup")
|
|
require.True(t, ok)
|
|
|
|
// Verify schedules
|
|
sched, ok := ctx.Schedules().Get("admin:system_cleanup")
|
|
require.True(t, ok)
|
|
assert.Equal(t, "0 4 * * *", sched.Spec)
|
|
|
|
// Verify settings
|
|
setting, ok := ctx.Settings().Get("admin.system_cleanup_cron")
|
|
require.True(t, ok)
|
|
assert.Equal(t, "0 4 * * *", setting.Default)
|
|
}
|