aboutsummaryrefslogtreecommitdiffstats
path: root/tests/core/fetch_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core/fetch_spec.lua')
-rw-r--r--tests/core/fetch_spec.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/core/fetch_spec.lua b/tests/core/fetch_spec.lua
index dac7c7b8..b4929167 100644
--- a/tests/core/fetch_spec.lua
+++ b/tests/core/fetch_spec.lua
@@ -29,6 +29,7 @@ describe("fetch", function()
assert.spy(spawn.curl).was_called_with {
{ "-H", "User-Agent: nvim-lsp-installer (+https://github.com/williamboman/nvim-lsp-installer)" },
"-fsSL",
+ vim.NIL,
"https://api.github.com",
}
end)
@@ -46,4 +47,33 @@ describe("fetch", function()
assert.equals([[{"data": "here"}]], result:get_or_throw())
end)
)
+
+ it(
+ "should respect out_file opt",
+ async_test(function()
+ stub(spawn, "wget")
+ stub(spawn, "curl")
+ spawn.wget.returns(Result.failure "wget failure")
+ spawn.curl.returns(Result.failure "curl failure")
+ fetch("https://api.github.com/data", { out_file = "/test.json" })
+
+ assert.spy(spawn.wget).was_called_with {
+ {
+ "--header",
+ "User-Agent: nvim-lsp-installer (+https://github.com/williamboman/nvim-lsp-installer)",
+ },
+ "-nv",
+ "-O",
+ "/test.json",
+ "https://api.github.com/data",
+ }
+
+ assert.spy(spawn.curl).was_called_with {
+ { "-H", "User-Agent: nvim-lsp-installer (+https://github.com/williamboman/nvim-lsp-installer)" },
+ "-fsSL",
+ { "-o", "/test.json" },
+ "https://api.github.com/data",
+ }
+ end)
+ )
end)