MCPcopy Index your code
hub / github.com/coder/coder / TestSearchTasks

Function TestSearchTasks

coderd/searchquery/search_test.go:1023–1217  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1021}
1022
1023func TestSearchTasks(t *testing.T) {
1024 t.Parallel()
1025
1026 userID := uuid.MustParse("10000000-0000-0000-0000-000000000001")
1027 orgID := uuid.MustParse("20000000-0000-0000-0000-000000000001")
1028
1029 testCases := []struct {
1030 Name string
1031 Query string
1032 ActorID uuid.UUID
1033 Expected database.ListTasksParams
1034 ExpectedErrorContains string
1035 Setup func(t *testing.T, db database.Store)
1036 }{
1037 {
1038 Name: "Empty",
1039 Query: "",
1040 Expected: database.ListTasksParams{},
1041 },
1042 {
1043 Name: "OwnerUsername",
1044 Query: "owner:alice",
1045 Setup: func(t *testing.T, db database.Store) {
1046 dbgen.User(t, db, database.User{
1047 ID: userID,
1048 Username: "alice",
1049 })
1050 },
1051 Expected: database.ListTasksParams{
1052 OwnerID: userID,
1053 },
1054 },
1055 {
1056 Name: "OwnerMe",
1057 Query: "owner:me",
1058 ActorID: userID,
1059 Expected: database.ListTasksParams{
1060 OwnerID: userID,
1061 },
1062 },
1063 {
1064 Name: "OwnerUUID",
1065 Query: fmt.Sprintf("owner:%s", userID),
1066 Expected: database.ListTasksParams{
1067 OwnerID: userID,
1068 },
1069 },
1070 {
1071 Name: "StatusActive",
1072 Query: "status:active",
1073 Expected: database.ListTasksParams{
1074 Status: "active",
1075 },
1076 },
1077 {
1078 Name: "StatusPending",
1079 Query: "status:pending",
1080 Expected: database.ListTasksParams{

Callers

nothing calls this directly

Calls 11

UserFunction · 0.92
OrganizationFunction · 0.92
NewDBFunction · 0.92
TasksFunction · 0.92
WriteStringMethod · 0.80
RunMethod · 0.65
SetupMethod · 0.65
ContainsMethod · 0.45
StringMethod · 0.45
LenMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected