0

我正在尝试测试 SQLDelight 中的插入。这是我的测试

fun `Add instrument Success`() = runTest {
        val name = "Paytm Wallet"
        val open = 1_000_00L
        val color = 2

        baseQueries.addInstrument(
            "bleh",
            name,
            open,
            color
        )

        val instruments = expandedQueries.getAllInstruments().executeAsList()

        assertThat(instruments.map { it.name }).contains(name)
    }

这会导致断言失败:

expected to contain: Paytm Wallet
but was            : [Physical Wallet]
expected to contain: Paytm Wallet
but was            : [Physical Wallet]

我知道查询是正确的,因为我在设置函数中插入了物理钱包并且它运行良好。这是设置的摘录:

baseQueries.addInstrument(
            "001",
            "Physical Wallet",
            500000L,
            1
        )

我应该如何为此编写测试?

这是现阶段我的 github 存储库的链接:https ://github.com/hardiksachan/Ledger/tree/9e96fd1c21fb1303987082465b81f467e8b699ed

4

0 回答 0