@@ -46,13 +46,13 @@ func TestAuthors(t *testing.T) {
4646
4747 t .Run ("CreateOrUpdateAuthorReturningBio" , func (t * testing.T ) {
4848 newBio := "Обновленная биография автора"
49- arg := CreateOrUpdateAuthorRetunringBioParams {
49+ arg := CreateOrUpdateAuthorReturningBioParams {
5050 P0 : 3 ,
5151 P1 : "Тестовый Автор" ,
5252 P2 : & newBio ,
5353 }
5454
55- returnedBio , err := q .CreateOrUpdateAuthorRetunringBio (ctx , arg )
55+ returnedBio , err := q .CreateOrUpdateAuthorReturningBio (ctx , arg )
5656 if err != nil {
5757 t .Fatalf ("failed to create or update author: %v" , err )
5858 }
@@ -67,6 +67,24 @@ func TestAuthors(t *testing.T) {
6767 t .Logf ("Author created or updated successfully with bio: %s" , * returnedBio )
6868 })
6969
70+ t .Run ("Update Author" , func (t * testing.T ) {
71+ arg := UpdateAuthorByIDParams {
72+ P0 : "Максим Горький" ,
73+ P1 : ptr ("Обновленная биография" ),
74+ P2 : 10 ,
75+ }
76+
77+ singleAuthor , err := q .UpdateAuthorByID (ctx , arg )
78+ if err != nil {
79+ t .Fatal (err )
80+ }
81+ bio := "Null"
82+ if singleAuthor .Bio != nil {
83+ bio = * singleAuthor .Bio
84+ }
85+ t .Logf ("- ID: %d | Name: %s | Bio: %s" , singleAuthor .ID , singleAuthor .Name , bio )
86+ })
87+
7088 t .Run ("ListAuthors" , func (t * testing.T ) {
7189 authors , err := q .ListAuthors (ctx )
7290 if err != nil {
@@ -115,24 +133,6 @@ func TestAuthors(t *testing.T) {
115133 }
116134 })
117135
118- t .Run ("ListAuthorsWithIdModulo" , func (t * testing.T ) {
119- authors , err := q .ListAuthorsWithIdModulo (ctx )
120- if err != nil {
121- t .Fatal (err )
122- }
123- if len (authors ) == 0 {
124- t .Fatal ("expected at least one author with even ID, got none" )
125- }
126- t .Log ("Authors with even IDs:" )
127- for _ , a := range authors {
128- bio := "Null"
129- if a .Bio != nil {
130- bio = * a .Bio
131- }
132- t .Logf ("- ID: %d | Name: %s | Bio: %s" , a .ID , a .Name , bio )
133- }
134- })
135-
136136 t .Run ("ListAuthorsWithNullBio" , func (t * testing.T ) {
137137 authors , err := q .ListAuthorsWithNullBio (ctx )
138138 if err != nil {
0 commit comments