aboutsummaryrefslogtreecommitdiffstats
path: root/tests/core/installer_spec.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-05-11 16:10:57 +0200
committerGitHub <noreply@github.com>2022-05-11 16:10:57 +0200
commit5e3385d90668c792919c7e2791620a6c0d569538 (patch)
tree4b0158d3ac7765db47411d57ec754a96f8eaf1f9 /tests/core/installer_spec.lua
parentchore!: remove zeta_note (diff)
downloadmason-5e3385d90668c792919c7e2791620a6c0d569538.tar
mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.gz
mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.bz2
mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.lz
mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.xz
mason-5e3385d90668c792919c7e2791620a6c0d569538.tar.zst
mason-5e3385d90668c792919c7e2791620a6c0d569538.zip
chore: further decouple module structure (#685)
Diffstat (limited to 'tests/core/installer_spec.lua')
-rw-r--r--tests/core/installer_spec.lua30
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/core/installer_spec.lua b/tests/core/installer_spec.lua
index cf8e8795..0e42f9e7 100644
--- a/tests/core/installer_spec.lua
+++ b/tests/core/installer_spec.lua
@@ -4,7 +4,7 @@ local fs = require "nvim-lsp-installer.core.fs"
local a = require "nvim-lsp-installer.core.async"
local installer = require "nvim-lsp-installer.core.installer"
local InstallContext = require "nvim-lsp-installer.core.installer.context"
-local process = require "nvim-lsp-installer.process"
+local process = require "nvim-lsp-installer.core.process"
local Optional = require "nvim-lsp-installer.core.optional"
local function timestamp()
@@ -16,8 +16,8 @@ describe("installer", function()
it(
"should call installer",
async_test(function()
- spy.on(fs, "mkdirp")
- spy.on(fs, "rename")
+ spy.on(fs.async, "mkdirp")
+ spy.on(fs.async, "rename")
local installer_fn = spy.new(
---@param c InstallContext
function(c)
@@ -38,17 +38,17 @@ describe("installer", function()
assert.is_nil(result:err_or_nil())
assert.spy(installer_fn).was_called(1)
assert.spy(installer_fn).was_called_with(match.ref(ctx))
- assert.spy(fs.mkdirp).was_called(1)
- assert.spy(fs.mkdirp).was_called_with(destination_dir .. ".tmp")
- assert.spy(fs.rename).was_called(1)
- assert.spy(fs.rename).was_called_with(destination_dir .. ".tmp", destination_dir)
+ assert.spy(fs.async.mkdirp).was_called(1)
+ assert.spy(fs.async.mkdirp).was_called_with(destination_dir .. ".tmp")
+ assert.spy(fs.async.rename).was_called(1)
+ assert.spy(fs.async.rename).was_called_with(destination_dir .. ".tmp", destination_dir)
end)
)
it(
"should return failure if installer errors",
async_test(function()
- spy.on(fs, "rmrf")
+ spy.on(fs.async, "rmrf")
local installer_fn = spy.new(function()
error("something went wrong. don't try again.", 4) -- 4 because spy.new callstack
end)
@@ -67,16 +67,16 @@ describe("installer", function()
assert.spy(installer_fn).was_called_with(match.ref(ctx))
assert.is_true(result:is_failure())
assert.equals("something went wrong. don't try again.", result:err_or_nil())
- assert.spy(fs.rmrf).was_called(2)
- assert.spy(fs.rmrf).was_called_with(destination_dir .. ".tmp")
- assert.spy(fs.rmrf).was_not_called_with(destination_dir)
+ assert.spy(fs.async.rmrf).was_called(2)
+ assert.spy(fs.async.rmrf).was_called_with(destination_dir .. ".tmp")
+ assert.spy(fs.async.rmrf).was_not_called_with(destination_dir)
end)
)
it(
"should write receipt",
async_test(function()
- spy.on(fs, "write_file")
+ spy.on(fs.async, "write_file")
local destination_dir = ("%s/installer_spec_receipt"):format(os.getenv "INSTALL_ROOT_DIR")
local ctx = InstallContext.new {
name = "installer_spec_receipt",
@@ -88,8 +88,8 @@ describe("installer", function()
installer.execute(ctx, function(c)
c.receipt:with_primary_source(c.receipt.npm "my-pkg")
end)
- assert.spy(fs.write_file).was_called(1)
- assert.spy(fs.write_file).was_called_with(
+ assert.spy(fs.async.write_file).was_called(1)
+ assert.spy(fs.async.write_file).was_called_with(
("%s.tmp/nvim-lsp-installer-receipt.json"):format(destination_dir),
match.is_string()
)
@@ -99,7 +99,7 @@ describe("installer", function()
it(
"should run async functions concurrently",
async_test(function()
- spy.on(fs, "write_file")
+ spy.on(fs.async, "write_file")
local destination_dir = ("%s/installer_spec_concurrent"):format(os.getenv "INSTALL_ROOT_DIR")
local ctx = InstallContext.new {
name = "installer_spec_receipt",