35 lines
795 B
Go
35 lines
795 B
Go
package webhooks_test
|
|
|
|
import (
|
|
"context"
|
|
"show-rss/src/db"
|
|
"show-rss/src/webhooks"
|
|
"testing"
|
|
)
|
|
|
|
func TestWebhooks(t *testing.T) {
|
|
ctx := db.Test(t, context.Background())
|
|
|
|
if did, err := webhooks.Did(ctx, "m", "u", "b"); err != nil {
|
|
t.Errorf("cannot Did() empty: %v", err)
|
|
} else if did {
|
|
t.Errorf("wrong Did() empty: %v", did)
|
|
}
|
|
|
|
if err := webhooks.Record(ctx, "m", "u", "b"); err != nil {
|
|
t.Errorf("cannot Record() empty: %v", err)
|
|
}
|
|
|
|
if did, err := webhooks.Did(ctx, "m", "u", "b"); err != nil {
|
|
t.Errorf("cannot Did() one: %v", err)
|
|
} else if !did {
|
|
t.Errorf("wrong Did() one: %v", did)
|
|
}
|
|
|
|
if did, err := webhooks.Did(ctx, "m2", "u", "b"); err != nil {
|
|
t.Errorf("cannot Did() wrong one: %v", err)
|
|
} else if did {
|
|
t.Errorf("wrong Did() wrong one: %v", did)
|
|
}
|
|
}
|