(t *testing.T)
| 897 | } |
| 898 | |
| 899 | func TestSubsUpdate(t *testing.T) { |
| 900 | update := map[string]any{ |
| 901 | "UpdatedAt": testData.Now.Add(22 * time.Minute), |
| 902 | } |
| 903 | err := adp.SubsUpdate(testData.Topics[0].Id, types.ParseUserId("usr"+testData.Users[0].Id), update) |
| 904 | if err != nil { |
| 905 | t.Fatal(err) |
| 906 | } |
| 907 | var got time.Time |
| 908 | err = db.QueryRow(ctx, "SELECT updatedat FROM subscriptions WHERE topic=$1 AND userid=$2", |
| 909 | testData.Topics[0].Id, decodeUid(testData.Users[0].Id)).Scan(&got) |
| 910 | if err != nil { |
| 911 | t.Fatal(err) |
| 912 | } |
| 913 | if got != update["UpdatedAt"] { |
| 914 | t.Error(mismatchErrorString("UpdatedAt", got, update["UpdatedAt"])) |
| 915 | } |
| 916 | |
| 917 | err = adp.SubsUpdate(testData.Topics[1].Id, types.ZeroUid, update) |
| 918 | if err != nil { |
| 919 | t.Fatal(err) |
| 920 | } |
| 921 | err = db.QueryRow(ctx, "SELECT updatedat FROM subscriptions WHERE topic=$1 LIMIT 1", |
| 922 | testData.Topics[1].Id).Scan(&got) |
| 923 | if err != nil { |
| 924 | t.Fatal(err) |
| 925 | } |
| 926 | if got != update["UpdatedAt"] { |
| 927 | t.Error(mismatchErrorString("UpdatedAt", got, update["UpdatedAt"])) |
| 928 | } |
| 929 | } |
| 930 | |
| 931 | func TestSubsDelete(t *testing.T) { |
| 932 | err := adp.SubsDelete(testData.Topics[1].Id, types.ParseUserId("usr"+testData.Users[0].Id)) |
nothing calls this directly
no test coverage detected
searching dependent graphs…