Chore: actions methods rename

This commit is contained in:
Grail Finder
2025-07-04 14:30:13 +03:00
parent 705881f1ea
commit 2a2bf4e23d
5 changed files with 23 additions and 20 deletions

View File

@ -35,7 +35,7 @@ func setupActionsTestDB(t *testing.T) (*sqlx.DB, func()) {
}
}
func TestActionsRepo_CreateAction(t *testing.T) {
func TestActionsRepo_ActionCreate(t *testing.T) {
db, teardown := setupActionsTestDB(t)
defer teardown()
@ -53,7 +53,7 @@ func TestActionsRepo_CreateAction(t *testing.T) {
RoomID: roomID,
}
err := repo.CreateAction(context.Background(), action)
err := repo.ActionCreate(context.Background(), action)
assert.NoError(t, err)
var retrievedAction models.Action
@ -95,7 +95,7 @@ func TestActionsRepo_ListActions(t *testing.T) {
_, err = db.Exec(`INSERT INTO actions (room_id, actor, actor_color, action_type, word, word_color, number_associated, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, roomID, action2.Actor, action2.ActorColor, action2.Action, action2.Word, action2.WordColor, action2.Number, action2.CreatedAt)
assert.NoError(t, err)
actions, err := repo.ListActions(context.Background(), roomID)
actions, err := repo.ActionList(context.Background(), roomID)
assert.NoError(t, err)
assert.Len(t, actions, 2)
assert.Equal(t, action1.Word, actions[0].Word)
@ -145,7 +145,7 @@ func TestActionsRepo_GetLastClue(t *testing.T) {
_, err = db.Exec(`INSERT INTO actions (room_id, actor, actor_color, action_type, word, word_color, number_associated, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, roomID, action3.Actor, action3.ActorColor, action3.Action, action3.Word, action3.WordColor, action3.Number, action3.CreatedAt)
assert.NoError(t, err)
lastClue, err := repo.GetLastClue(context.Background(), roomID)
lastClue, err := repo.ActionGetLastClue(context.Background(), roomID)
assert.NoError(t, err)
assert.NotNil(t, lastClue)
assert.Equal(t, action2.Word, lastClue.Word)
@ -170,7 +170,7 @@ func TestActionsRepo_DeleteActionsByRoomID(t *testing.T) {
_, err := db.Exec(`INSERT INTO actions (room_id, actor, actor_color, action_type, word, word_color, number_associated, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, roomID, action1.Actor, action1.ActorColor, action1.Action, action1.Word, action1.WordColor, action1.Number, action1.CreatedAt)
assert.NoError(t, err)
err = repo.DeleteActionsByRoomID(context.Background(), roomID)
err = repo.ActionDeleteByRoomID(context.Background(), roomID)
assert.NoError(t, err)
var count int
@ -178,4 +178,3 @@ func TestActionsRepo_DeleteActionsByRoomID(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 0, count)
}