diff options
| author | William Boman <william@redwill.se> | 2023-04-03 00:33:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-02 22:33:48 +0000 |
| commit | 0114336145771ff7c528debba52c5ff21bf6f7a2 (patch) | |
| tree | 37802cb27b602c9c3e900aec7f3ad012ed3b8719 /tests | |
| parent | chore: consolidate generate task (#1171) (diff) | |
| download | mason-0114336145771ff7c528debba52c5ff21bf6f7a2.tar mason-0114336145771ff7c528debba52c5ff21bf6f7a2.tar.gz mason-0114336145771ff7c528debba52c5ff21bf6f7a2.tar.bz2 mason-0114336145771ff7c528debba52c5ff21bf6f7a2.tar.lz mason-0114336145771ff7c528debba52c5ff21bf6f7a2.tar.xz mason-0114336145771ff7c528debba52c5ff21bf6f7a2.tar.zst mason-0114336145771ff7c528debba52c5ff21bf6f7a2.zip | |
refactor: only schedule in a.scheduler() when in fast event (#1170)
Explicitly schedule via `a.wait(vim.schedule)` instead.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mason-core/EventEmitter_spec.lua | 2 | ||||
| -rw-r--r-- | tests/mason-core/managers/powershell_spec.lua | 1 | ||||
| -rw-r--r-- | tests/mason-core/terminator_spec.lua | 4 | ||||
| -rw-r--r-- | tests/mason-core/ui_spec.lua | 10 | ||||
| -rw-r--r-- | tests/mason/api/command_spec.lua | 6 |
5 files changed, 11 insertions, 12 deletions
diff --git a/tests/mason-core/EventEmitter_spec.lua b/tests/mason-core/EventEmitter_spec.lua index fc01e3ab..caec8a80 100644 --- a/tests/mason-core/EventEmitter_spec.lua +++ b/tests/mason-core/EventEmitter_spec.lua @@ -49,7 +49,7 @@ describe("EventEmitter", function() local emitter = EventEmitter.init(setmetatable({}, { __index = EventEmitter })) emitter:on("event", mockx.throws "My error.") emitter:emit "event" - a.scheduler() + a.wait(vim.schedule) assert.spy(vim.api.nvim_err_writeln).was_called(1) assert.spy(vim.api.nvim_err_writeln).was_called_with "My error." end) diff --git a/tests/mason-core/managers/powershell_spec.lua b/tests/mason-core/managers/powershell_spec.lua index dbec05bf..297c85ae 100644 --- a/tests/mason-core/managers/powershell_spec.lua +++ b/tests/mason-core/managers/powershell_spec.lua @@ -32,7 +32,6 @@ describe("powershell manager", function() vim.fn.executable.on_call_with("pwsh").returns(0) local powershell = powershell() - a.scheduler() powershell.command "echo 'Is this bash?'" assert.spy(spawn.pwsh).was_called(0) diff --git a/tests/mason-core/terminator_spec.lua b/tests/mason-core/terminator_spec.lua index 6d7c1612..d8d0f2eb 100644 --- a/tests/mason-core/terminator_spec.lua +++ b/tests/mason-core/terminator_spec.lua @@ -27,7 +27,7 @@ describe("terminator", function() local dummy2_handle = dummy2:install() terminator.terminate(5000) - a.scheduler() + a.wait(vim.schedule) assert.spy(InstallHandle.terminate).was_called(2) assert.spy(InstallHandle.terminate).was_called_with(match.is_ref(dummy_handle)) assert.spy(InstallHandle.terminate).was_called_with(match.is_ref(dummy2_handle)) @@ -67,7 +67,7 @@ describe("terminator", function() }, }, true, {}) - a.scheduler() + a.wait(vim.schedule) assert.spy(vim.api.nvim_err_writeln).was_called(1) assert.spy(vim.api.nvim_err_writeln).was_called_with(_.dedent [[ diff --git a/tests/mason-core/ui_spec.lua b/tests/mason-core/ui_spec.lua index 8c80cc3b..40a8b888 100644 --- a/tests/mason-core/ui_spec.lua +++ b/tests/mason-core/ui_spec.lua @@ -186,7 +186,7 @@ describe("integration test", function() window.open() -- Initial window and buffer creation + initial render - a.scheduler() + a.wait(vim.schedule) assert.spy(win_set_option).was_called(9) assert.spy(win_set_option).was_called_with(match.is_number(), "number", false) @@ -245,7 +245,7 @@ describe("integration test", function() end) assert.spy(set_lines).was_called(1) - a.scheduler() + a.wait(vim.schedule) assert.spy(set_lines).was_called(2) assert @@ -288,12 +288,12 @@ describe("integration test", function() local mutate_state = window.state { show_extra_lines = false } window.init {} window.open() - a.scheduler() + a.wait(vim.schedule) window.set_cursor { 5, 3 } -- move cursor to sticky line mutate_state(function(state) state.show_extra_lines = true end) - a.scheduler() + a.wait(vim.schedule) local cursor = window.get_cursor() assert.same({ 8, 3 }, cursor) end) @@ -311,7 +311,7 @@ describe("integration test", function() window.state {} window.init { border = "rounded" } window.open() - a.scheduler() + a.wait(vim.schedule) assert.spy(nvim_open_win).was_called(1) assert.spy(nvim_open_win).was_called_with( diff --git a/tests/mason/api/command_spec.lua b/tests/mason/api/command_spec.lua index 7b77bae3..00dfdff8 100644 --- a/tests/mason/api/command_spec.lua +++ b/tests/mason/api/command_spec.lua @@ -13,7 +13,7 @@ describe(":Mason", function() "should open the UI window", async_test(function() api.Mason() - a.scheduler() + a.wait(vim.schedule) local win = vim.api.nvim_get_current_win() local buf = vim.api.nvim_win_get_buf(win) assert.equals("mason", vim.api.nvim_buf_get_option(buf, "filetype")) @@ -103,7 +103,7 @@ describe(":MasonUpdate", function() assert.spy(vim.notify).was_called_with("Updating registries…", vim.log.levels.INFO, { title = "mason.nvim", }) - a.scheduler() + a.wait(vim.schedule) assert.spy(vim.notify).was_called_with("Successfully updated 1 registry.", vim.log.levels.INFO, { title = "mason.nvim", }) @@ -122,7 +122,7 @@ describe(":MasonUpdate", function() assert.spy(vim.notify).was_called_with("Updating registries…", vim.log.levels.INFO, { title = "mason.nvim", }) - a.scheduler() + a.wait(vim.schedule) assert.spy(vim.notify).was_called_with("Failed to update registries: Some error.", vim.log.levels.ERROR, { title = "mason.nvim", }) |
