Skip to main content
Help improve this documentation

This documentation is still new and evolving. If you spot any mistakes, unclear explanations, or missing details, please open an issue.

Your feedback helps us improve!

testify operatorsโ€‹

This page lists all operators available in the testify sub-package of ro.

Installโ€‹

First, import the sub-package in your project:

go get -u github.com/samber/ro/plugins/testify
  • Creates test assertions for observables.

    import (
    "testing"

    "github.com/samber/ro"
    rotestify "github.com/samber/ro/plugins/testify"
    "github.com/stretchr/testify/assert"
    )

    func TestMyObservable(t *testing.T) {
    is := assert.New(t)

    obs := ro.Pipe(
    ro.Just(1, 2, 3),
    ro.Map(func(x int) int { return x * 2 }),
    )

    spec := rotestify.Testify[int](is)
    obs.Subscribe(spec.Expect(2, 4, 6))

    // Test will pass if values match expected
    }
    Prototype:
    func Testify[T any](is *assert.Assertions)