diff options
Diffstat (limited to 'tests/core/async_spec.lua')
| -rw-r--r-- | tests/core/async_spec.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/core/async_spec.lua b/tests/core/async_spec.lua index 42c1fe65..7d965e9b 100644 --- a/tests/core/async_spec.lua +++ b/tests/core/async_spec.lua @@ -1,5 +1,6 @@ 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" @@ -15,7 +16,7 @@ describe("async", function() a.sleep(1000) end) local stop = timestamp() - local grace_ms = 5 + local grace_ms = 25 assert.is_true((stop - start) >= (1000 - grace_ms)) end) @@ -47,4 +48,15 @@ describe("async", function() assert.spy(james_bond).was_not.called() end) ) + + it( + "should reject if async function raises error", + async_test(function() + local ok, err = a.promisify(function() + error "something went wrong" + end)() + assert.is_false(ok) + assert.is_true(match.has_match "something went wrong$"(err)) + end) + ) end) |
