blob: 8559e35331a1e0f3920bc484632d9e5be38e1eab (
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
|
local composer = require "mason-core.installer.managers.composer"
local match = require "luassert.match"
local spy = require "luassert.spy"
local test_helpers = require "mason-test.helpers"
describe("composer manager", function()
it("should install", function()
local ctx = test_helpers.create_context()
ctx:execute(function()
composer.install("my-package", "1.0.0")
end)
assert.spy(ctx.spawn.composer).was_called(2)
assert.spy(ctx.spawn.composer).was_called_with {
"init",
"--no-interaction",
"--stability=stable",
}
assert.spy(ctx.spawn.composer).was_called_with {
"require",
"my-package:1.0.0",
}
end)
it("should write output", function()
local ctx = test_helpers.create_context()
spy.on(ctx.stdio_sink, "stdout")
ctx:execute(function()
composer.install("my-package", "1.0.0")
end)
assert
.spy(ctx.stdio_sink.stdout)
.was_called_with(match.is_ref(ctx.stdio_sink), "Installing composer package my-package@1.0.0…\n")
end)
end)
|