Skip to content

Commit

Permalink
test: remove stocasticity in test and add small wait before each test
Browse files Browse the repository at this point in the history
This should increase test success rate
  • Loading branch information
S1M0N38 committed Sep 4, 2024
1 parent b6439ae commit 5931d53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion lua/dante/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ config.defaults = {
{
role = "system",
content = [[
{{NOW}}
You are an assistant responsible for correcting errors in text.
Refine the spelling and grammar while closely adhering to the original version.
Expand Down
12 changes: 8 additions & 4 deletions spec/dante_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local opts = {
api_key = vim.fn.getenv("GROQ_API_KEY_DANTE_NVIM"),
},
request = {
temperature = 0.00001,
temperature = 0,
-- NOTE: Groq is soo fast that I need to used the slower model (70b) to test the stream option.
-- Otherwise, the new completion chunk is returned before the previous one is processed.
model = "llama-3.1-70b-versatile", -- Groq (External)
Expand All @@ -26,7 +26,7 @@ local opts = {
},
request = {
model = "llama-3.1-70b-versatile",
temperature = 0.00001,
temperature = 0,
stream = false,
messages = {
{
Expand Down Expand Up @@ -87,6 +87,7 @@ describe("dante.main with default preset", function()

it("fix incorrect lines in md file (stream=false)", function()
-- Run dante.main
vim.wait(100)
local job_id = dante.main("default", start_line, end_line)
vim.fn.jobwait({ job_id }, 10000)

Expand All @@ -99,10 +100,12 @@ describe("dante.main with default preset", function()
end)

it("fix incorrect lines in md file (stream=true)", function()
opts.presets["default"].request.stream = true
dante.setup(opts)
local opts_stream = vim.deepcopy(opts)
opts_stream.presets["default"].request.stream = true
dante.setup(opts_stream)

-- Run dante.main
vim.wait(100)
local job_id = dante.main("default", start_line, end_line)
vim.fn.jobwait({ job_id }, 10000)

Expand All @@ -127,6 +130,7 @@ describe("dante.main with placeholders in the selected lines (vimdoc preset)", f
start_line, end_line = 1, 12 -- line to be fixed (all lines)

-- Run dante.main
vim.wait(100)
local job_id = dante.main("vimdoc", start_line, end_line)
vim.fn.jobwait({ job_id }, 10000)

Expand Down

0 comments on commit 5931d53

Please sign in to comment.