(t *testing.T)
| 168 | } |
| 169 | |
| 170 | func TestTopicCreateP2P(t *testing.T) { |
| 171 | err := adp.TopicCreateP2P(testData.Subs[2], testData.Subs[3]) |
| 172 | if err != nil { |
| 173 | t.Fatal(err) |
| 174 | } |
| 175 | |
| 176 | oldModeGiven := testData.Subs[2].ModeGiven |
| 177 | testData.Subs[2].ModeGiven = 255 |
| 178 | err = adp.TopicCreateP2P(testData.Subs[4], testData.Subs[2]) |
| 179 | if err != nil { |
| 180 | t.Fatal(err) |
| 181 | } |
| 182 | |
| 183 | var got types.Subscription |
| 184 | var userId int64 |
| 185 | var modeWant, modeGiven []byte |
| 186 | err = db.QueryRow(ctx, "SELECT createdat,updatedat,deletedat,userid,topic,delid,recvseqid,readseqid,modewant,modegiven,private FROM subscriptions WHERE topic=$1 AND userid=$2", |
| 187 | testData.Subs[2].Topic, decodeUid(testData.Subs[2].User)).Scan(&got.CreatedAt, |
| 188 | &got.UpdatedAt, &got.DeletedAt, &userId, &got.Topic, &got.DelId, &got.RecvSeqId, &got.ReadSeqId, |
| 189 | &modeWant, &modeGiven, &got.Private) |
| 190 | if err != nil { |
| 191 | t.Fatal(err) |
| 192 | } |
| 193 | got.ModeGiven.Scan(modeGiven) |
| 194 | if got.ModeGiven == oldModeGiven { |
| 195 | t.Error("ModeGiven update failed") |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | func TestTopicShare(t *testing.T) { |
| 200 | if err := adp.TopicShare(testData.Subs[0].Topic, testData.Subs); err != nil { |
nothing calls this directly
no test coverage detected
searching dependent graphs…