================== Update tests ================================
(t *testing.T)
| 649 | |
| 650 | // ================== Update tests ================================ |
| 651 | func TestUserUpdate(t *testing.T) { |
| 652 | update := map[string]any{ |
| 653 | "UserAgent": "Test Agent v0.11", |
| 654 | "UpdatedAt": testData.Now.Add(30 * time.Minute), |
| 655 | } |
| 656 | err := adp.UserUpdate(types.ParseUserId("usr"+testData.Users[0].Id), update) |
| 657 | if err != nil { |
| 658 | t.Fatal(err) |
| 659 | } |
| 660 | |
| 661 | var got struct { |
| 662 | UserAgent string |
| 663 | UpdatedAt time.Time |
| 664 | CreatedAt time.Time |
| 665 | } |
| 666 | err = db.QueryRow(ctx, "SELECT useragent, updatedat, createdat FROM users WHERE id=$1", |
| 667 | decodeUid(testData.Users[0].Id)).Scan(&got.UserAgent, &got.UpdatedAt, &got.CreatedAt) |
| 668 | if err != nil { |
| 669 | t.Fatal(err) |
| 670 | } |
| 671 | if got.UserAgent != "Test Agent v0.11" { |
| 672 | t.Error(mismatchErrorString("UserAgent", got.UserAgent, "Test Agent v0.11")) |
| 673 | } |
| 674 | if got.UpdatedAt == got.CreatedAt { |
| 675 | t.Error("UpdatedAt field not updated") |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | func TestUserUpdateTags(t *testing.T) { |
| 680 | addTags := testData.Tags[0] |
nothing calls this directly
no test coverage detected
searching dependent graphs…