Skip to main content

RxBrioTestUtils

Tracks which values of a brio observable are alive, to assert on with expect.

local alivePlayers = RxBrioTestUtils.collectAliveList(controller.maid, RxPlayerUtils.observePlayersBrio())

expect(alivePlayers).toContain(player)

player:Destroy()

expect(alivePlayers).never.toContain(player)

Functions​

collectAliveList​

RxBrioTestUtils.collectAliveList(
maid: Maid,
observable: Observable<Brio<T>>
) → {T}

Collects the values whose brios are alive, in emission order, until the maid cleans up.

collectAliveSet​

RxBrioTestUtils.collectAliveSet(
maid: Maid,
observable: Observable<Brio<T>>
) → {[T]: true}

Collects the set of values with an alive brio, until the maid cleans up.

Show raw api
{
    "functions": [
        {
            "name": "collectAliveList",
            "desc": "Collects the values whose brios are alive, in emission order, until the maid cleans up.",
            "params": [
                {
                    "name": "maid",
                    "desc": "",
                    "lua_type": "Maid"
                },
                {
                    "name": "observable",
                    "desc": "",
                    "lua_type": "Observable<Brio<T>>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ T }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 33,
                "path": "src/brio/src/Shared/Test/RxBrioTestUtils.lua"
            }
        },
        {
            "name": "collectAliveSet",
            "desc": "Collects the set of values with an alive brio, until the maid cleans up.",
            "params": [
                {
                    "name": "maid",
                    "desc": "",
                    "lua_type": "Maid"
                },
                {
                    "name": "observable",
                    "desc": "",
                    "lua_type": "Observable<Brio<T>>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [T]: true }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 73,
                "path": "src/brio/src/Shared/Test/RxBrioTestUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "RxBrioTestUtils",
    "desc": "Tracks which values of a brio observable are alive, to assert on with `expect`.\n\n```lua\nlocal alivePlayers = RxBrioTestUtils.collectAliveList(controller.maid, RxPlayerUtils.observePlayersBrio())\n\nexpect(alivePlayers).toContain(player)\n\nplayer:Destroy()\n\nexpect(alivePlayers).never.toContain(player)\n```",
    "source": {
        "line": 17,
        "path": "src/brio/src/Shared/Test/RxBrioTestUtils.lua"
    }
}