This commit is contained in:
@@ -716,7 +716,7 @@ func TestSharedBoardCreateAssignMoveAndPermissions(t *testing.T) {
|
||||
if boardResponse.Code != http.StatusOK {
|
||||
t.Fatalf("board page status: %d body %s", boardResponse.Code, boardResponse.Body.String())
|
||||
}
|
||||
for _, expected := range []string{"Ship the onboarding flow", "Board Member", "Workspace Admin", "1405-05-06", "High", "Filters", "Manage tags", "Tags", "select multiple", "Create a new tag", "People & importance", "Card controls", "Backend", "Frontend", "Urgent", "/static/board.js", `data-board-column="backlog"`} {
|
||||
for _, expected := range []string{"Ship the onboarding flow", "Board Member", "Workspace Admin", "1405-05-06", "High priority", "Backlog", "To do", "Filters", "Manage tags", "Tags", "select multiple", "Create a new tag", "People & importance", "To-do list", "Backend", "Frontend", "Urgent", "/static/board.js", `data-board-column="backlog"`} {
|
||||
if !strings.Contains(boardResponse.Body.String(), expected) {
|
||||
t.Fatalf("board page does not include %q", expected)
|
||||
}
|
||||
@@ -756,6 +756,39 @@ func TestSharedBoardCreateAssignMoveAndPermissions(t *testing.T) {
|
||||
if len(tasks[0].Assignees) != 1 || tasks[0].Assignees[0].ID != memberID || tasks[0].Importance != "urgent" {
|
||||
t.Fatalf("task people or importance were not updated: %#v", tasks[0])
|
||||
}
|
||||
todoPath := "/board/tasks/" + strconv.FormatInt(tasks[0].ID, 10) + "/todos"
|
||||
createTodo := formRequest(t, s.http.Handler, todoPath, url.Values{
|
||||
"csrf": {memberCSRF},
|
||||
"body": {"Confirm the onboarding handoff"},
|
||||
}, memberCookie)
|
||||
if createTodo.Code != http.StatusSeeOther || createTodo.Header().Get("Location") != "/board?flash=To-do+item+added" {
|
||||
t.Fatalf("create to-do: got %d location %q", createTodo.Code, createTodo.Header().Get("Location"))
|
||||
}
|
||||
tasks, _ = s.store.BoardTasks()
|
||||
if len(tasks[0].Todos) != 1 || tasks[0].Todos[0].Body != "Confirm the onboarding handoff" || tasks[0].TodoDone != 0 {
|
||||
t.Fatalf("created to-do was not loaded: %#v", tasks[0])
|
||||
}
|
||||
toggleTodoPath := todoPath + "/" + strconv.FormatInt(tasks[0].Todos[0].ID, 10) + "/toggle"
|
||||
toggleTodo := formRequest(t, s.http.Handler, toggleTodoPath, url.Values{
|
||||
"csrf": {memberCSRF},
|
||||
"completed": {"on"},
|
||||
}, memberCookie)
|
||||
if toggleTodo.Code != http.StatusSeeOther || toggleTodo.Header().Get("Location") != "/board?flash=To-do+item+updated" {
|
||||
t.Fatalf("toggle to-do: got %d location %q", toggleTodo.Code, toggleTodo.Header().Get("Location"))
|
||||
}
|
||||
tasks, _ = s.store.BoardTasks()
|
||||
if !tasks[0].Todos[0].Completed || tasks[0].TodoDone != 1 {
|
||||
t.Fatalf("to-do completion was not saved: %#v", tasks[0].Todos)
|
||||
}
|
||||
deleteTodoPath := todoPath + "/" + strconv.FormatInt(tasks[0].Todos[0].ID, 10) + "/delete"
|
||||
deleteTodo := formRequest(t, s.http.Handler, deleteTodoPath, url.Values{"csrf": {memberCSRF}}, memberCookie)
|
||||
if deleteTodo.Code != http.StatusSeeOther || deleteTodo.Header().Get("Location") != "/board?flash=To-do+item+removed" {
|
||||
t.Fatalf("delete to-do: got %d location %q", deleteTodo.Code, deleteTodo.Header().Get("Location"))
|
||||
}
|
||||
tasks, _ = s.store.BoardTasks()
|
||||
if len(tasks[0].Todos) != 0 {
|
||||
t.Fatalf("to-do was not deleted: %#v", tasks[0].Todos)
|
||||
}
|
||||
matchingFilterPath := "/board?tag=" + strconv.FormatInt(tags[0].ID, 10) +
|
||||
"&assignee=" + strconv.FormatInt(memberID, 10) + "&priority=urgent"
|
||||
matchingFilterRequest := httptest.NewRequest(http.MethodGet, matchingFilterPath, nil)
|
||||
|
||||
Reference in New Issue
Block a user