diff --git a/internal/board/board.go b/internal/board/board.go index d6de19d..4f93348 100644 --- a/internal/board/board.go +++ b/internal/board/board.go @@ -200,8 +200,8 @@ func (b *Board) MoveToStatus(args MoveToStatusArgs) error { } type CardArgs struct { - NewTitle string - NewContent string + NewTitle string + NewDescription string } // CreateCard creates a card in the database. @@ -218,10 +218,10 @@ func (b *Board) CreateCard(args CardArgs) (int, error) { } card := Card{ - ID: -1, - Title: args.NewTitle, - Content: args.NewContent, - Created: timestamp, + ID: -1, + Title: args.NewTitle, + Description: args.NewDescription, + Created: timestamp, } cardID, err := db.Write(b.db, db.CardBucket, &card) @@ -309,8 +309,8 @@ func (b *Board) UpdateCard(args UpdateCardArgs) error { card.Title = args.NewTitle } - if len(args.NewContent) > 0 { - card.Content = args.NewContent + if len(args.NewDescription) > 0 { + card.Description = args.NewDescription } if _, err := db.Write(b.db, db.CardBucket, &card); err != nil { diff --git a/internal/board/card.go b/internal/board/card.go index ee362ab..ab47112 100644 --- a/internal/board/card.go +++ b/internal/board/card.go @@ -14,7 +14,7 @@ func (e CardNotExistError) Error() string { type Card struct { ID int Title string - Content string + Description string Created string } diff --git a/internal/board/card_lifecycle_test.go b/internal/board/card_lifecycle_test.go index 0d19af5..f8dedaa 100644 --- a/internal/board/card_lifecycle_test.go +++ b/internal/board/card_lifecycle_test.go @@ -35,7 +35,7 @@ func TestCardLifecycle(t *testing.T) { initialCardContent := "Ensure that this card is safely stored in the database." expectedCardID := 1 expectedStatusID := 1 - timestamp := time.Now().Format(time.DateOnly) + timestamp := time.Now().Format(time.DateTime) t.Run("Test Create Card", testCreateCard(kanban, initialCardTitle, initialCardContent, expectedCardID, expectedStatusID)) @@ -59,7 +59,7 @@ func testCreateCard(kanban board.Board, title, content string, expectedCardID, e args := board.CardArgs{ NewTitle: title, - NewContent: content, + NewDescription: content, } if _, err := kanban.CreateCard(args); err != nil { @@ -87,7 +87,7 @@ func testCreateCard(kanban board.Board, title, content string, expectedCardID, e } } -func testReadCard(kanban board.Board, cardID int, wantTitle, wantContent, wantTimestamp string) func(t *testing.T) { +func testReadCard(kanban board.Board, cardID int, wantTitle, wantDescription, wantTimestamp string) func(t *testing.T) { return func(t *testing.T) { t.Log("When a card is read from the database.") @@ -102,10 +102,10 @@ func testReadCard(kanban board.Board, cardID int, wantTitle, wantContent, wantTi t.Logf("%s\tExpected card title received, got: %s.", success, card.Title) } - if card.Content != wantContent { - t.Errorf("%s\tUnexpected card content received, want: %s, got: %s.", failure, wantContent, card.Content) + if card.Description != wantDescription { + t.Errorf("%s\tUnexpected card content received, want: %s, got: %s.", failure, wantDescription, card.Description) } else { - t.Logf("%s\tExpected card content received, got: %s.", success, card.Content) + t.Logf("%s\tExpected card content received, got: %s.", success, card.Description) } if card.Created != wantTimestamp { @@ -124,7 +124,7 @@ func testUpdateCard(kanban board.Board, cardID int, newTitle, newContent, timest CardID: cardID, CardArgs: board.CardArgs{ NewTitle: newTitle, - NewContent: newContent, + NewDescription: newContent, }, } @@ -140,7 +140,7 @@ func testUpdateCard(kanban board.Board, cardID int, newTitle, newContent, timest want := board.Card{ ID: cardID, Title: newTitle, - Content: newContent, + Description: newContent, Created: timestamp, } @@ -160,7 +160,7 @@ func testUpdateCardContent(kanban board.Board, cardID int, expectedTitle, newCon CardID: cardID, CardArgs: board.CardArgs{ NewTitle: "", - NewContent: newContent, + NewDescription: newContent, }, } @@ -176,7 +176,7 @@ func testUpdateCardContent(kanban board.Board, cardID int, expectedTitle, newCon want := board.Card{ ID: cardID, Title: expectedTitle, - Content: newContent, + Description: newContent, Created: timestamp, } diff --git a/internal/board/status_lifecycle_test.go b/internal/board/status_lifecycle_test.go index a03d419..a53783d 100644 --- a/internal/board/status_lifecycle_test.go +++ b/internal/board/status_lifecycle_test.go @@ -128,7 +128,7 @@ func testMoveCardToStatus(kanban board.Board) func(t *testing.T) { title := "Test card." - cardArgs := board.CardArgs{NewTitle: title, NewContent: ""} + cardArgs := board.CardArgs{NewTitle: title, NewDescription: ""} cardID, err := kanban.CreateCard(cardArgs) if err != nil { diff --git a/internal/db/database_test.go b/internal/db/database_test.go index 400d330..00d49ad 100644 --- a/internal/db/database_test.go +++ b/internal/db/database_test.go @@ -165,7 +165,7 @@ func TestReadAndWriteCards(t *testing.T) { singleCard := board.Card{ ID: -1, Title: "A test task.", - Content: "This task should be completed.", + Description: "This task should be completed.", } singleCardID := testWriteOneCard(t, database, singleCard) @@ -175,17 +175,17 @@ func TestReadAndWriteCards(t *testing.T) { { ID: -1, Title: "Test card A.", - Content: "This is test card A.", + Description: "This is test card A.", }, { ID: -1, Title: "Test card B.", - Content: "This is test card B.", + Description: "This is test card B.", }, { ID: -1, Title: "Test card C.", - Content: "This is test card C.", + Description: "This is test card C.", }, } @@ -225,7 +225,7 @@ func testReadOneCard(t *testing.T, database *bolt.DB, cardID int) { want := board.Card{ ID: 1, Title: "A test task.", - Content: "This task should be completed.", + Description: "This task should be completed.", } if !reflect.DeepEqual(got, want) { @@ -280,17 +280,17 @@ func testReadManyCards(t *testing.T, database *bolt.DB, cardIDs []int) { { ID: 2, Title: "Test card A.", - Content: "This is test card A.", + Description: "This is test card A.", }, { ID: 3, Title: "Test card B.", - Content: "This is test card B.", + Description: "This is test card B.", }, { ID: 4, Title: "Test card C.", - Content: "This is test card C.", + Description: "This is test card C.", }, } @@ -328,7 +328,7 @@ func TestDeleteOneCard(t *testing.T) { card := board.Card{ ID: -1, Title: "Test card", - Content: "", + Description: "", } cardID, err := db.Write(database, db.CardBucket, &card) diff --git a/internal/ui/ui.go b/internal/ui/ui.go index bffd0ce..f87ecb5 100644 --- a/internal/ui/ui.go +++ b/internal/ui/ui.go @@ -220,7 +220,7 @@ func (u *UI) initQuitModal() { func (u *UI) newCard(title, content string) error { args := board.CardArgs{ NewTitle: title, - NewContent: content, + NewDescription: content, } if _, err := u.board.CreateCard(args); err != nil {