Skip to main content

RxTestUtils

Collects what an observable emits into a table to assert on with expect.

local versions = RxTestUtils.collectList(controller.maid, attributeValue:Observe())

attributeValue.Value = "2.0.0"

expect(versions).toEqual({ "1.0.0", "2.0.0" })

Functions​

collectList​

RxTestUtils.collectList(
maid: Maid,
observable: Observable<T>--

Only the first value of each emission is recorded

) → {T}

Collects every value emitted, in order, until the maid cleans up.

collectListTuples​

RxTestUtils.collectListTuples(
maid: Maid,
observable: Observable<...any>
) → {{any}}

Collects every value of each emission as a list, until the maid cleans up.

collectSynchronousList​

RxTestUtils.collectSynchronousList(
observable: Observable<T>--

Only the first value of each emission is recorded

) → {T}

Returns the values emitted synchronously on subscribe, then unsubscribes.

collectSet​

RxTestUtils.collectSet(
maid: Maid,
observable: Observable<T>--

Only the first value of each emission is recorded

) → {[T]: true}

Collects the set of non-nil values emitted, until the maid cleans up.

Show raw api
{
    "functions": [
        {
            "name": "collectList",
            "desc": "Collects every value emitted, in order, until the maid cleans up.",
            "params": [
                {
                    "name": "maid",
                    "desc": "",
                    "lua_type": "Maid"
                },
                {
                    "name": "observable",
                    "desc": "Only the first value of each emission is recorded",
                    "lua_type": "Observable<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 30,
                "path": "src/rx/src/Shared/Test/RxTestUtils.lua"
            }
        },
        {
            "name": "collectListTuples",
            "desc": "Collects every value of each emission as a list, until the maid cleans up.",
            "params": [
                {
                    "name": "maid",
                    "desc": "",
                    "lua_type": "Maid"
                },
                {
                    "name": "observable",
                    "desc": "",
                    "lua_type": "Observable<...any>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ { any } }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 52,
                "path": "src/rx/src/Shared/Test/RxTestUtils.lua"
            }
        },
        {
            "name": "collectSynchronousList",
            "desc": "Returns the values emitted synchronously on subscribe, then unsubscribes.",
            "params": [
                {
                    "name": "observable",
                    "desc": "Only the first value of each emission is recorded",
                    "lua_type": "Observable<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 71,
                "path": "src/rx/src/Shared/Test/RxTestUtils.lua"
            }
        },
        {
            "name": "collectSet",
            "desc": "Collects the set of non-nil values emitted, until the maid cleans up.",
            "params": [
                {
                    "name": "maid",
                    "desc": "",
                    "lua_type": "Maid"
                },
                {
                    "name": "observable",
                    "desc": "Only the first value of each emission is recorded",
                    "lua_type": "Observable<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [T]: true }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 93,
                "path": "src/rx/src/Shared/Test/RxTestUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "RxTestUtils",
    "desc": "Collects what an observable emits into a table to assert on with `expect`.\n\n```lua\nlocal versions = RxTestUtils.collectList(controller.maid, attributeValue:Observe())\n\nattributeValue.Value = \"2.0.0\"\n\nexpect(versions).toEqual({ \"1.0.0\", \"2.0.0\" })\n```",
    "source": {
        "line": 15,
        "path": "src/rx/src/Shared/Test/RxTestUtils.lua"
    }
}