The picker accepts one MP4 or WebM, the thread lightbox zooms photos, and Discord gets the video as a file on a follow-up message so photo embeds still render.
This commit is contained in:
@@ -102,3 +102,44 @@ func TestBusDropsWhenFull(t *testing.T) {
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
func TestNopReleasesPostCreated(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
released := false
|
||||
Nop{}.Publish(context.Background(), PostCreated{Release: func() { released = true }})
|
||||
if !released {
|
||||
t.Fatal("Nop.Publish did not release held upload")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBusDropReleasesPostCreated(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
bus := newBus(1, false)
|
||||
bus.Publish(context.Background(), "kept")
|
||||
released := false
|
||||
bus.Publish(context.Background(), PostCreated{Release: func() { released = true }})
|
||||
if !released {
|
||||
t.Fatal("dropped PostCreated did not release held upload")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubscribeReleasePostedToDiscord(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
bus := New()
|
||||
defer bus.Close()
|
||||
SubscribeRelease(bus)
|
||||
|
||||
released := make(chan struct{})
|
||||
bus.Publish(context.Background(), PostedToDiscord{
|
||||
PostID: "post-1",
|
||||
Release: func() { close(released) },
|
||||
})
|
||||
select {
|
||||
case <-released:
|
||||
case <-time.After(time.Second):
|
||||
t.Fatal("PostedToDiscord did not release")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user