Skip to content

Commit

Permalink
✅ Add tests for LatestKeysUploadTs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Danieloni1 committed Sep 26, 2023
1 parent 80e6ca5 commit 3ab2f6a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions clientapi/clientapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,24 @@ func TestKeys(t *testing.T) {
if err != nil {
t.Fatal(err)
}
dataReq := uapi.QueryAccountDataRequest{
UserID: alice.ID,
DataType: "account_data",
RoomID: "",
}
res := uapi.QueryAccountDataResponse{}
if err = userAPI.QueryAccountData(processCtx.Context(), &dataReq, &res); err != nil {
t.Fatal(err)
}
var accoundData uapi.AccountData
err = json.Unmarshal(res.GlobalAccountData["account_data"], &accoundData)
if err != nil {
t.Fatal(err)
}
if accoundData.LatestKeysUploadTs == 0 ||
time.Now().UnixMilli()-accoundData.LatestKeysUploadTs > 5*time.Second.Milliseconds() {
t.Fatal(err)
}

// tests `/keys/query`
dev, err := oc.GetOrFetchDevice(ctx, id.UserID(alice.ID), id.DeviceID(accessTokens[alice].deviceID))
Expand Down

0 comments on commit 3ab2f6a

Please sign in to comment.