diff options
| author | William Boman <william@redwill.se> | 2022-05-11 16:10:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-11 16:10:57 +0200 |
| commit | 5e3385d90668c792919c7e2791620a6c0d569538 (patch) | |
| tree | 4b0158d3ac7765db47411d57ec754a96f8eaf1f9 /tests/core | |
| parent | chore!: remove zeta_note (diff) | |
| download | mason-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')
| -rw-r--r-- | tests/core/async_spec.lua (renamed from tests/core/async/async_spec.lua) | 11 | ||||
| -rw-r--r-- | tests/core/fs_spec.lua | 2 | ||||
| -rw-r--r-- | tests/core/functional_spec.lua | 166 | ||||
| -rw-r--r-- | tests/core/installer_spec.lua | 30 | ||||
| -rw-r--r-- | tests/core/path_spec.lua | 23 | ||||
| -rw-r--r-- | tests/core/platform_spec.lua | 159 | ||||
| -rw-r--r-- | tests/core/process_spec.lua | 2 | ||||
| -rw-r--r-- | tests/core/spawn_spec.lua | 2 | ||||
| -rw-r--r-- | tests/core/ui_spec.lua | 250 |
9 files changed, 626 insertions, 19 deletions
diff --git a/tests/core/async/async_spec.lua b/tests/core/async_spec.lua index c0e8992e..eab4bc70 100644 --- a/tests/core/async/async_spec.lua +++ b/tests/core/async_spec.lua @@ -2,7 +2,7 @@ local assert = require "luassert" local spy = require "luassert.spy" local match = require "luassert.match" local a = require "nvim-lsp-installer.core.async" -local process = require "nvim-lsp-installer.process" +local process = require "nvim-lsp-installer.core.process" local function timestamp() local seconds, microseconds = vim.loop.gettimeofday() @@ -20,6 +20,15 @@ describe("async", function() assert.is_true((stop - start) >= (100 - grace_ms)) end) + it("should return values in blocking mode", function() + local function slow_maths(arg1, arg2) + a.sleep(10) + return arg1 + arg2 - 42 + end + local value = a.run_blocking(slow_maths, 13, 37) + assert.equals(8, value) + end) + it( "should pass arguments to .run", async_test(function() diff --git a/tests/core/fs_spec.lua b/tests/core/fs_spec.lua index 121c57d6..0202df64 100644 --- a/tests/core/fs_spec.lua +++ b/tests/core/fs_spec.lua @@ -12,7 +12,7 @@ describe("fs", function() "refuses to rmrf paths outside of boundary", async_test(function() local e = assert.has.errors(function() - fs.rmrf "/thisisa/path" + fs.async.rmrf "/thisisa/path" end) assert.equal( diff --git a/tests/core/functional_spec.lua b/tests/core/functional_spec.lua new file mode 100644 index 00000000..8301d47e --- /dev/null +++ b/tests/core/functional_spec.lua @@ -0,0 +1,166 @@ +local functional = require "nvim-lsp-installer.core.functional" +local spy = require "luassert.spy" +local match = require "luassert.match" + +describe("functional", function() + it("creates enums", function() + local colors = functional.enum { + "BLUE", + "YELLOW", + } + assert.same({ + ["BLUE"] = "BLUE", + ["YELLOW"] = "YELLOW", + }, colors) + end) + + it("creates sets", function() + local colors = functional.set_of { + "BLUE", + "YELLOW", + "BLUE", + "RED", + } + assert.same({ + ["BLUE"] = true, + ["YELLOW"] = true, + ["RED"] = true, + }, colors) + end) + + it("reverses lists", function() + local colors = { "BLUE", "YELLOW", "RED" } + assert.same({ + "RED", + "YELLOW", + "BLUE", + }, functional.list_reverse(colors)) + -- should not modify in-place + assert.same({ "BLUE", "YELLOW", "RED" }, colors) + end) + + it("maps over list", function() + local colors = { "BLUE", "YELLOW", "RED" } + assert.same( + { + "LIGHT_BLUE1", + "LIGHT_YELLOW2", + "LIGHT_RED3", + }, + functional.list_map(function(color, i) + return "LIGHT_" .. color .. i + end, colors) + ) + -- should not modify in-place + assert.same({ "BLUE", "YELLOW", "RED" }, colors) + end) + + it("coalesces first non-nil value", function() + assert.equal("Hello World!", functional.coalesce(nil, nil, "Hello World!", "")) + end) + + it("makes a shallow copy of a list", function() + local list = { "BLUE", { nested = "TABLE" }, "RED" } + local list_copy = functional.list_copy(list) + assert.same({ "BLUE", { nested = "TABLE" }, "RED" }, list_copy) + assert.is_not.is_true(list == list_copy) + assert.is_true(list[2] == list_copy[2]) + end) + + it("finds first item that fulfills predicate", function() + local predicate = spy.new(function(item) + return item == "Waldo" + end) + + assert.equal( + "Waldo", + functional.list_find_first(predicate, { + "Where", + "On Earth", + "Is", + "Waldo", + "?", + }) + ) + assert.spy(predicate).was.called(4) + end) + + it("determines whether any item in the list fulfills predicate", function() + local predicate = spy.new(function(item) + return item == "On Earth" + end) + + assert.is_true(functional.list_any(predicate, { + "Where", + "On Earth", + "Is", + "Waldo", + "?", + })) + + assert.spy(predicate).was.called(2) + end) + + it("memoizes functions with default cache mechanism", function() + local expensive_function = spy.new(function(s) + return s + end) + local memoized_fn = functional.memoize(expensive_function) + assert.equal("key", memoized_fn "key") + assert.equal("key", memoized_fn "key") + assert.equal("new_key", memoized_fn "new_key") + assert.spy(expensive_function).was_called(2) + end) + + it("memoizes function with custom cache mechanism", function() + local expensive_function = spy.new(function(arg1, arg2) + return arg1 .. arg2 + end) + local memoized_fn = functional.memoize(expensive_function, function(arg1, arg2) + return arg1 .. arg2 + end) + assert.equal("key1key2", memoized_fn("key1", "key2")) + assert.equal("key1key2", memoized_fn("key1", "key2")) + assert.equal("key1key3", memoized_fn("key1", "key3")) + assert.spy(expensive_function).was_called(2) + end) + + it("should evaluate functions lazily", function() + local impl = spy.new(function() + return {}, {} + end) + local lazy_fn = functional.lazy(impl) + assert.spy(impl).was_called(0) + local a, b = lazy_fn() + assert.spy(impl).was_called(1) + assert.is_true(match.is_table()(a)) + assert.is_true(match.is_table()(b)) + local new_a, new_b = lazy_fn() + assert.spy(impl).was_called(1) + assert.is_true(match.is_ref(a)(new_a)) + assert.is_true(match.is_ref(b)(new_b)) + end) + + it("should support nil return values in lazy functions", function() + local lazy_fn = functional.lazy(function() + return nil, 2 + end) + local a, b = lazy_fn() + assert.is_nil(a) + assert.equal(2, b) + end) + + it("should partially apply functions", function() + local funcy = spy.new() + local partially_funcy = functional.partial(funcy, "a", "b", "c") + partially_funcy("d", "e", "f") + assert.spy(funcy).was_called_with("a", "b", "c", "d", "e", "f") + end) + + it("should partially apply functions with nil arguments", function() + local funcy = spy.new() + local partially_funcy = functional.partial(funcy, "a", nil, "c") + partially_funcy("d", nil, "f") + assert.spy(funcy).was_called_with("a", nil, "c", "d", nil, "f") + end) +end) 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", diff --git a/tests/core/path_spec.lua b/tests/core/path_spec.lua new file mode 100644 index 00000000..e4e964d9 --- /dev/null +++ b/tests/core/path_spec.lua @@ -0,0 +1,23 @@ +local path = require "nvim-lsp-installer.core.path" + +describe("path", function() + it("concatenates paths", function() + assert.equal("foo/bar/baz/~", path.concat { "foo", "bar", "baz", "~" }) + end) + + it("concatenates paths on Windows", function() + local old_os = jit.os + jit.os = "windows" + package.loaded["nvim-lsp-installer.core.path"] = nil + local path = require "nvim-lsp-installer.core.path" + assert.equal([[foo\bar\baz\~]], path.concat { "foo", "bar", "baz", "~" }) + jit.os = old_os + end) + + it("identifies subdirectories", function() + assert.is_true(path.is_subdirectory("/foo/bar", "/foo/bar/baz")) + assert.is_true(path.is_subdirectory("/foo/bar", "/foo/bar")) + assert.is_false(path.is_subdirectory("/foo/bar", "/foo/bas/baz")) + assert.is_false(path.is_subdirectory("/foo/bar", "/foo/bars/baz")) + end) +end) diff --git a/tests/core/platform_spec.lua b/tests/core/platform_spec.lua new file mode 100644 index 00000000..96d3b879 --- /dev/null +++ b/tests/core/platform_spec.lua @@ -0,0 +1,159 @@ +local stub = require "luassert.stub" +local spy = require "luassert.spy" +local match = require "luassert.match" + +describe("platform", function() + local function platform() + package.loaded["nvim-lsp-installer.core.platform"] = nil + return require "nvim-lsp-installer.core.platform" + end + + local function stub_mac(arch) + arch = arch or "x86_64" + stub(vim.fn, "has") + stub(vim.loop, "os_uname") + vim.loop.os_uname.returns { machine = arch } + vim.fn.has.on_call_with("mac").returns(1) + vim.fn.has.on_call_with("unix").returns(1) + vim.fn.has.on_call_with(match._).returns(0) + end + + local function stub_linux() + stub(vim.fn, "has") + vim.fn.has.on_call_with("mac").returns(0) + vim.fn.has.on_call_with("unix").returns(1) + vim.fn.has.on_call_with(match._).returns(0) + end + + local function stub_windows() + stub(vim.fn, "has") + vim.fn.has.on_call_with("win32").returns(1) + vim.fn.has.on_call_with(match._).returns(0) + end + + it("should be able to detect platform and arch", function() + stub_mac "arm64" + assert.is_true(platform().is.mac_arm64) + assert.is_false(platform().is.mac_x64) + assert.is_false(platform().is.nothing) + end) + + it("should be able to detect macos", function() + stub_mac() + assert.is_true(platform().is_mac) + assert.is_true(platform().is.mac) + assert.is_true(platform().is_unix) + assert.is_true(platform().is.unix) + assert.is_false(platform().is_linux) + assert.is_false(platform().is.linux) + assert.is_false(platform().is_win) + assert.is_false(platform().is.win) + end) + + it("should be able to detect linux", function() + stub_linux() + assert.is_false(platform().is_mac) + assert.is_false(platform().is.mac) + assert.is_true(platform().is_unix) + assert.is_true(platform().is.unix) + assert.is_true(platform().is_linux) + assert.is_true(platform().is.linux) + assert.is_false(platform().is_win) + assert.is_false(platform().is.win) + end) + + it("should be able to detect windows", function() + stub_windows() + assert.is_false(platform().is_mac) + assert.is_false(platform().is.mac) + assert.is_false(platform().is_unix) + assert.is_false(platform().is.unix) + assert.is_false(platform().is_linux) + assert.is_false(platform().is.linux) + assert.is_true(platform().is_win) + assert.is_true(platform().is.win) + end) + + it("should run correct case on linux", function() + local unix = spy.new() + local win = spy.new() + local mac = spy.new() + local linux = spy.new() + + stub_linux() + platform().when { + unix = unix, + win = win, + linux = linux, + mac = mac, + } + assert.spy(unix).was_not_called() + assert.spy(mac).was_not_called() + assert.spy(win).was_not_called() + assert.spy(linux).was_called(1) + end) + + it("should run correct case on mac", function() + local unix = spy.new() + local win = spy.new() + local mac = spy.new() + local linux = spy.new() + + stub_mac() + platform().when { + unix = unix, + win = win, + linux = linux, + mac = mac, + } + assert.spy(unix).was_not_called() + assert.spy(mac).was_called(1) + assert.spy(win).was_not_called() + assert.spy(linux).was_not_called() + end) + + it("should run correct case on windows", function() + local unix = spy.new() + local win = spy.new() + local mac = spy.new() + local linux = spy.new() + + stub_windows() + platform().when { + unix = unix, + win = win, + linux = linux, + mac = mac, + } + assert.spy(unix).was_not_called() + assert.spy(mac).was_not_called() + assert.spy(win).was_called(1) + assert.spy(linux).was_not_called() + end) + + it("should run correct case on mac (unix)", function() + local unix = spy.new() + local win = spy.new() + + stub_mac() + platform().when { + unix = unix, + win = win, + } + assert.spy(unix).was_called(1) + assert.spy(win).was_not_called() + end) + + it("should run correct case on linux (unix)", function() + local unix = spy.new() + local win = spy.new() + + stub_linux() + platform().when { + unix = unix, + win = win, + } + assert.spy(unix).was_called(1) + assert.spy(win).was_not_called() + end) +end) diff --git a/tests/core/process_spec.lua b/tests/core/process_spec.lua index 3c76b462..d27d3186 100644 --- a/tests/core/process_spec.lua +++ b/tests/core/process_spec.lua @@ -1,5 +1,5 @@ local spy = require "luassert.spy" -local process = require "nvim-lsp-installer.process" +local process = require "nvim-lsp-installer.core.process" local async = require "plenary.async" describe("process.attempt", function() diff --git a/tests/core/spawn_spec.lua b/tests/core/spawn_spec.lua index d4716b61..b3dfce35 100644 --- a/tests/core/spawn_spec.lua +++ b/tests/core/spawn_spec.lua @@ -2,7 +2,7 @@ local spy = require "luassert.spy" local stub = require "luassert.stub" local match = require "luassert.match" local spawn = require "nvim-lsp-installer.core.spawn" -local process = require "nvim-lsp-installer.process" +local process = require "nvim-lsp-installer.core.process" describe("async spawn", function() it( diff --git a/tests/core/ui_spec.lua b/tests/core/ui_spec.lua new file mode 100644 index 00000000..67190ee3 --- /dev/null +++ b/tests/core/ui_spec.lua @@ -0,0 +1,250 @@ +local match = require "luassert.match" +local spy = require "luassert.spy" +local display = require "nvim-lsp-installer.core.ui.display" +local Ui = require "nvim-lsp-installer.core.ui" +local a = require "nvim-lsp-installer.core.async" + +describe("ui", function() + it("produces a correct tree", function() + local function renderer(state) + return Ui.CascadingStyleNode({ "INDENT" }, { + Ui.When(not state.is_active, function() + return Ui.Text { + "I'm not active", + "Another line", + } + end), + Ui.When(state.is_active, function() + return Ui.Text { + "I'm active", + "Yet another line", + } + end), + }) + end + + assert.same({ + children = { + { + type = "HL_TEXT", + lines = { + { { "I'm not active", "" } }, + { { "Another line", "" } }, + }, + }, + { + type = "NODE", + children = {}, + }, + }, + styles = { "INDENT" }, + type = "CASCADING_STYLE", + }, renderer { is_active = false }) + + assert.same({ + children = { + { + type = "NODE", + children = {}, + }, + { + type = "HL_TEXT", + lines = { + { { "I'm active", "" } }, + { { "Yet another line", "" } }, + }, + }, + }, + styles = { "INDENT" }, + type = "CASCADING_STYLE", + }, renderer { is_active = true }) + end) + + it("renders a tree correctly", function() + local render_output = display._render_node( + { + win_width = 120, + }, + Ui.CascadingStyleNode({ "INDENT" }, { + Ui.Keybind("i", "INSTALL_SERVER", { "sumneko_lua" }, true), + Ui.HlTextNode { + { + { "Hello World!", "MyHighlightGroup" }, + }, + { + { "Another Line", "Comment" }, + }, + }, + Ui.HlTextNode { + { + { "Install something idk", "Stuff" }, + }, + }, + Ui.Keybind("<CR>", "INSTALL_SERVER", { "tsserver" }, false), + Ui.Text { "I'm a text node" }, + }) + ) + + assert.same({ + highlights = { + { + col_start = 2, + col_end = 14, + line = 0, + hl_group = "MyHighlightGroup", + }, + { + col_start = 2, + col_end = 14, + line = 1, + hl_group = "Comment", + }, + { + col_start = 2, + col_end = 23, + line = 2, + hl_group = "Stuff", + }, + }, + lines = { " Hello World!", " Another Line", " Install something idk", " I'm a text node" }, + virt_texts = {}, + keybinds = { + { + effect = "INSTALL_SERVER", + key = "i", + line = -1, + payload = { "sumneko_lua" }, + }, + { + effect = "INSTALL_SERVER", + key = "<CR>", + line = 3, + payload = { "tsserver" }, + }, + }, + }, render_output) + end) +end) + +describe("integration test", function() + it( + "calls vim APIs as expected during rendering", + async_test(function() + local window = display.new_view_only_win "test" + + window.view(function(state) + return Ui.Node { + Ui.Keybind("U", "EFFECT", nil, true), + Ui.Text { + "Line number 1!", + state.text, + }, + Ui.Keybind("R", "R_EFFECT", { state.text }), + Ui.HlTextNode { + { + { "My highlighted text", "MyHighlightGroup" }, + }, + }, + } + end) + + local mutate_state = window.init { text = "Initial state" } + + window.open { + effects = { + ["EFFECT"] = function() end, + ["R_EFFECT"] = function() end, + }, + highlight_groups = { + "hi def MyHighlight gui=bold", + }, + } + + local clear_namespace = spy.on(vim.api, "nvim_buf_clear_namespace") + local buf_set_option = spy.on(vim.api, "nvim_buf_set_option") + local win_set_option = spy.on(vim.api, "nvim_win_set_option") + local set_lines = spy.on(vim.api, "nvim_buf_set_lines") + local set_extmark = spy.on(vim.api, "nvim_buf_set_extmark") + local add_highlight = spy.on(vim.api, "nvim_buf_add_highlight") + local set_keymap = spy.on(vim.api, "nvim_buf_set_keymap") + + -- Initial window and buffer creation + initial render + a.scheduler() + + assert.spy(win_set_option).was_called(8) + assert.spy(win_set_option).was_called_with(match.is_number(), "number", false) + assert.spy(win_set_option).was_called_with(match.is_number(), "relativenumber", false) + assert.spy(win_set_option).was_called_with(match.is_number(), "wrap", false) + assert.spy(win_set_option).was_called_with(match.is_number(), "spell", false) + assert.spy(win_set_option).was_called_with(match.is_number(), "foldenable", false) + assert.spy(win_set_option).was_called_with(match.is_number(), "signcolumn", "no") + assert.spy(win_set_option).was_called_with(match.is_number(), "colorcolumn", "") + assert.spy(win_set_option).was_called_with(match.is_number(), "cursorline", true) + + assert.spy(buf_set_option).was_called(9) + assert.spy(buf_set_option).was_called_with(match.is_number(), "modifiable", false) + assert.spy(buf_set_option).was_called_with(match.is_number(), "swapfile", false) + assert.spy(buf_set_option).was_called_with(match.is_number(), "textwidth", 0) + assert.spy(buf_set_option).was_called_with(match.is_number(), "buftype", "nofile") + assert.spy(buf_set_option).was_called_with(match.is_number(), "bufhidden", "wipe") + assert.spy(buf_set_option).was_called_with(match.is_number(), "buflisted", false) + assert.spy(buf_set_option).was_called_with(match.is_number(), "filetype", "lsp-installer") + + assert.spy(set_lines).was_called(1) + assert.spy(set_lines).was_called_with( + match.is_number(), + 0, + -1, + false, + { "Line number 1!", "Initial state", "My highlighted text" } + ) + + assert.spy(set_extmark).was_called(0) + + assert.spy(add_highlight).was_called(1) + assert.spy(add_highlight).was_called_with( + match.is_number(), + match.is_number(), + "MyHighlightGroup", + 2, + 0, + 19 + ) + + assert.spy(set_keymap).was_called(2) + assert.spy(set_keymap).was_called_with( + match.is_number(), + "n", + "U", + match.has_match [[<cmd>lua require%('nvim%-lsp%-installer%.core%.ui%.display'%)%.dispatch_effect%(%d, "55"%)<cr>]], + { nowait = true, silent = true, noremap = true } + ) + assert.spy(set_keymap).was_called_with( + match.is_number(), + "n", + "R", + match.has_match [[<cmd>lua require%('nvim%-lsp%-installer%.core%.ui%.display'%)%.dispatch_effect%(%d, "52"%)<cr>]], + { nowait = true, silent = true, noremap = true } + ) + + assert.spy(clear_namespace).was_called(1) + assert.spy(clear_namespace).was_called_with(match.is_number(), match.is_number(), 0, -1) + + mutate_state(function(state) + state.text = "New state" + end) + + assert.spy(set_lines).was_called(1) + a.scheduler() + assert.spy(set_lines).was_called(2) + + assert.spy(set_lines).was_called_with( + match.is_number(), + 0, + -1, + false, + { "Line number 1!", "New state", "My highlighted text" } + ) + end) + ) +end) |
