From 20fdbb7509621de7997e00377be75740857093b3 Mon Sep 17 00:00:00 2001 From: Huynh Duc Dung Date: Wed, 25 Oct 2023 10:53:53 +0800 Subject: [PATCH] refactor: rename the user command --- README.md | 6 +++--- lua/hurl/wrapper.lua | 2 +- test/hurl_spec.lua | 12 ++++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 test/hurl_spec.lua diff --git a/README.md b/README.md index 9937adc..33d4f47 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Add the following configuration to your Neovim setup: "jellydn/hurl.nvim", ft = "hurl", dependencies = { "MunifTanjim/nui.nvim" }, - cmd = { "HurlRun" }, + cmd = { "HurlRunner" }, opts = { -- Show debugging info debug = false, @@ -27,9 +27,9 @@ Add the following configuration to your Neovim setup: }, keys = { -- Run API request - { "ra", "HurlRun", desc = "Run API requests" }, + { "ra", "HurlRunner", desc = "Run API requests" }, -- Run API request in visual mode - { "cr", ":HurlRun", desc = "Run API request", mode = "v" }, + { "cr", ":HurlRunner", desc = "Run API request", mode = "v" }, }, } } diff --git a/lua/hurl/wrapper.lua b/lua/hurl/wrapper.lua index 626cf76..62ad8c0 100644 --- a/lua/hurl/wrapper.lua +++ b/lua/hurl/wrapper.lua @@ -143,7 +143,7 @@ local function run_selection(opts) end function M.setup() - util.create_cmd('HurlRun', function(opts) + util.create_cmd('HurlRunner', function(opts) if opts.range ~= 0 then run_selection(opts.fargs) else diff --git a/test/hurl_spec.lua b/test/hurl_spec.lua new file mode 100644 index 0000000..47d79e7 --- /dev/null +++ b/test/hurl_spec.lua @@ -0,0 +1,12 @@ +local hurl = require('hurl.wrapper') + +describe('Hurl wrapper', function() + it('should be able to load', function() + assert.truthy(hurl) + end) + + it('should define a custom command: HurlRunner', function() + -- TODO: add a test to check if the command is defined + assert.falsy(true) + end) +end)