Skip to main content

DataStoreTestUtils

Shared setup helpers for the DataStore server specs.

Functions​

setup​

DataStoreTestUtils.setup() → DataStoreTestController

Builds a controller over a fresh DataStoreMock and a ServiceBag with a MessagingServiceMock injected. Everything it builds is cleaned up on Destroy.

setupDataStoreManager​

DataStoreTestUtils.setupDataStoreManager() → DataStoreManagerTestController

Builds a controller over a PlayerDataStoreManager backed by a fresh DataStoreMock, keyed user_<userId>. Destroy closes the game before cleaning up.

newServiceBag​

DataStoreTestUtils.newServiceBag(
maid: Maid,
robloxMessagingService: MessagingServiceMock?--

injected when provided

) → ServiceBag

Builds a started ServiceBag with PlaceMessagingService and BindToCloseService, owned by the maid.

newDataStore​

DataStoreTestUtils.newDataStore(
maid: Maid,
key: string
) → DataStore

Builds a DataStore over mock and owns it with the maid.

newSessionLockedStore​

DataStoreTestUtils.newSessionLockedStore(
maid: Maid,
key: string,
userIdList: {number}?--

defaults to { 1 }

) → DataStore

Builds a session-locked DataStore over mock and owns it with the maid.

newMessageHelper​

DataStoreTestUtils.newMessageHelper(
maid: Maid,
serviceBag: ServiceBag,
dataStore: DataStore
) → DataStoreMessageHelper

Builds a DataStoreMessageHelper over dataStore and owns it with the maid.

Show raw api
{
    "functions": [
        {
            "name": "setup",
            "desc": "Builds a controller over a fresh [DataStoreMock] and a [ServiceBag] with a [MessagingServiceMock]\ninjected. Everything it builds is cleaned up on `Destroy`.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "DataStoreTestController"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 61,
                "path": "src/datastore/src/Server/DataStoreTestUtils.lua"
            }
        },
        {
            "name": "setupDataStoreManager",
            "desc": "Builds a controller over a [PlayerDataStoreManager] backed by a fresh [DataStoreMock], keyed\n`user_<userId>`. `Destroy` closes the game before cleaning up.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "DataStoreManagerTestController"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 141,
                "path": "src/datastore/src/Server/DataStoreTestUtils.lua"
            }
        },
        {
            "name": "newServiceBag",
            "desc": "Builds a started [ServiceBag] with PlaceMessagingService and [BindToCloseService], owned by the maid.",
            "params": [
                {
                    "name": "maid",
                    "desc": "",
                    "lua_type": "Maid"
                },
                {
                    "name": "robloxMessagingService",
                    "desc": "injected when provided",
                    "lua_type": "MessagingServiceMock?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "ServiceBag"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 187,
                "path": "src/datastore/src/Server/DataStoreTestUtils.lua"
            }
        },
        {
            "name": "newDataStore",
            "desc": "Builds a [DataStore] over `mock` and owns it with the maid.",
            "params": [
                {
                    "name": "maid",
                    "desc": "",
                    "lua_type": "Maid"
                },
                {
                    "name": "mock",
                    "desc": "",
                    "lua_type": "DataStoreMock"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "DataStore"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 211,
                "path": "src/datastore/src/Server/DataStoreTestUtils.lua"
            }
        },
        {
            "name": "newSessionLockedStore",
            "desc": "Builds a session-locked [DataStore] over `mock` and owns it with the maid.",
            "params": [
                {
                    "name": "maid",
                    "desc": "",
                    "lua_type": "Maid"
                },
                {
                    "name": "mock",
                    "desc": "",
                    "lua_type": "DataStoreMock"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "userIdList",
                    "desc": "defaults to { 1 }",
                    "lua_type": "{ number }?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "DataStore"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 228,
                "path": "src/datastore/src/Server/DataStoreTestUtils.lua"
            }
        },
        {
            "name": "newMessageHelper",
            "desc": "Builds a [DataStoreMessageHelper] over `dataStore` and owns it with the maid.",
            "params": [
                {
                    "name": "maid",
                    "desc": "",
                    "lua_type": "Maid"
                },
                {
                    "name": "serviceBag",
                    "desc": "",
                    "lua_type": "ServiceBag"
                },
                {
                    "name": "dataStore",
                    "desc": "",
                    "lua_type": "DataStore"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "DataStoreMessageHelper"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 248,
                "path": "src/datastore/src/Server/DataStoreTestUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "DataStoreTestUtils",
    "desc": "Shared setup helpers for the DataStore server specs.",
    "source": {
        "line": 7,
        "path": "src/datastore/src/Server/DataStoreTestUtils.lua"
    }
}