================== Update tests ================================
(t *testing.T)
| 645 | |
| 646 | // ================== Update tests ================================ |
| 647 | func TestUserUpdate(t *testing.T) { |
| 648 | update := map[string]any{ |
| 649 | "UserAgent": "Test Agent v0.11", |
| 650 | "UpdatedAt": testData.Now.Add(30 * time.Minute), |
| 651 | } |
| 652 | err := adp.UserUpdate(types.ParseUserId("usr"+testData.Users[0].Id), update) |
| 653 | if err != nil { |
| 654 | t.Fatal(err) |
| 655 | } |
| 656 | |
| 657 | cursor, err := rdb.Table("users").Get(testData.Users[0].Id).Pluck("UserAgent", "UpdatedAt", "CreatedAt").Run(conn) |
| 658 | if err != nil { |
| 659 | t.Fatal(err) |
| 660 | } |
| 661 | defer cursor.Close() |
| 662 | |
| 663 | var got struct { |
| 664 | UserAgent string |
| 665 | UpdatedAt time.Time |
| 666 | CreatedAt time.Time |
| 667 | } |
| 668 | if err = cursor.One(&got); 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.Equal(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…