Skip to content

Commit

Permalink
Add missing script
Browse files Browse the repository at this point in the history
  • Loading branch information
kegsay committed Jan 26, 2024
1 parent c0f019e commit 4ed6b23
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package main

import (
"fmt"
"time"

"github.com/matrix-org/complement-crypto/internal/api"
"github.com/matrix-org/complement-crypto/internal/api/rust"
)

func main() {
t := &api.MockT{}
cfg := api.ClientCreationOpts{
BaseURL: "{{.BaseURL}}",
UserID: "{{.UserID}}",
DeviceID: "{{.DeviceID}}",
Password: "{{.Password}}",
PersistentStorage: {{.PersistentStorage}},
}
client, err := rust.NewRustClient(t, cfg, "{{.SSURL}}")
if err != nil {
panic(err)
}
if err := client.Login(t, cfg); err != nil {
panic(err)
}
client.MustStartSyncing(t)
defer client.Close(t)
roomID := "{{.RoomID}}"
fmt.Println("Client logged in. Sending '{{.Body}}' in room {{.RoomID}}")
eventID := client.SendMessage(t, "{{.RoomID}}", "{{.Body}}")
fmt.Println("Sent event " + eventID +" waiting for remote echo")

waiter := client.WaitUntilEventInRoom(t, roomID, api.CheckEventHasEventID(eventID))
waiter.Wait(t, 5 * time.Second)

time.Sleep(time.Second)
fmt.Println("exiting")
}

0 comments on commit 4ed6b23

Please sign in to comment.