aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mason-core/managers/dotnet_spec.lua
blob: e61bebb8e14e531f93fa6c320e2c2d0a6fbc9351 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
local installer = require "mason-core.installer"
local dotnet = require "mason-core.managers.dotnet"

describe("dotnet manager", function()
    it(
        "should call dotnet tool update",
        async_test(function()
            local handle = InstallHandleGenerator "dummy"
            local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
            installer.prepare_installer(ctx)
            installer.exec_in_context(ctx, dotnet.package "main-package")
            assert.spy(ctx.spawn.dotnet).was_called(1)
            assert.spy(ctx.spawn.dotnet).was_called_with {
                "tool",
                "update",
                "--ignore-failed-sources",
                "--tool-path",
                ".",
                { "--version", "42.13.37" },
                "main-package",
            }
        end)
    )

    it(
        "should provide receipt information",
        async_test(function()
            local handle = InstallHandleGenerator "dummy"
            local ctx = InstallContextGenerator(handle, { version = "42.13.37" })
            installer.prepare_installer(ctx)
            installer.exec_in_context(ctx, dotnet.package "main-package")
            assert.same({
                type = "dotnet",
                package = "main-package",
            }, ctx.receipt.primary_source)
        end)
    )
end)