mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
Full module path rebrand from Temporal to Hanzo Tasks: - go.mod module: github.com/hanzoai/tasks - All internal Go imports updated (1906 files) - cmd/server renamed to cmd/tasksd - Binary name: tasksd (was temporal-server) - Docker images: hanzoai/tasks (was temporalio/server) - README rewritten with Hanzo Tasks branding - LLM.md created with integration notes - Makefile, goreleaser, CI workflows updated - go.temporal.io/sdk and go.temporal.io/api imports preserved (separate repos) Fork of Temporal.io (MIT license).
52 lines
1.0 KiB
Go
52 lines
1.0 KiB
Go
package tdbg
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
"github.com/hanzoai/tasks/service/history/tasks"
|
|
)
|
|
|
|
func TestGetCategory(t *testing.T) {
|
|
cat101 := tasks.NewCategory(101, tasks.CategoryTypeImmediate, "CategoryName")
|
|
|
|
registry := tasks.NewDefaultTaskCategoryRegistry()
|
|
registry.AddCategory(cat101)
|
|
|
|
testCases := []struct {
|
|
name string
|
|
input string
|
|
expectedCat tasks.Category
|
|
expectedErr string
|
|
}{
|
|
{
|
|
name: "same case",
|
|
input: "CategoryName",
|
|
expectedCat: cat101,
|
|
},
|
|
{
|
|
name: "different case",
|
|
input: "cAtEgOrYnAmE",
|
|
expectedCat: cat101,
|
|
},
|
|
{
|
|
name: "not found",
|
|
input: "random",
|
|
expectedErr: "unknown task category \"random\"",
|
|
},
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
s := require.New(t)
|
|
cat, err := getCategory(registry, tc.input)
|
|
if tc.expectedErr == "" {
|
|
s.NoError(err)
|
|
s.Equal(tc.expectedCat, cat)
|
|
} else {
|
|
s.ErrorContains(err, tc.expectedErr)
|
|
}
|
|
})
|
|
}
|
|
}
|