@@ -38,8 +38,12 @@ describe("utils", function()
3838 end )
3939
4040 describe (" latest_release" , function ()
41+ before_each (function ()
42+ vim .fn .delete (" ./tmp/version-cache" , " rf" )
43+ end )
44+
4145 it (" returns the latest release for the repo" , function ()
42- local result = utils .latest_release (" elixir-tools" , " next-ls" , { cache_dir = " ./tmp/" })
46+ local result = utils .latest_release (" elixir-tools" , " next-ls" , { cache_dir = " ./tmp/version-cache/ " })
4347
4448 assert (type (result ) == " string" )
4549 assert .is .Truthy (string.match (result , " %d+%.%d+%.%d+" ))
@@ -50,18 +54,19 @@ describe("utils", function()
5054 local result = utils .latest_release (
5155 " elixir-tools" ,
5256 " next-ls" ,
53- { github_host = " localhost:9999" , cache_dir = " ./tmp/" }
57+ { github_host = " localhost:9999" , cache_dir = " ./tmp/version-cache/ " }
5458 )
5559
5660 assert .is .Nil (result )
5761 end )
5862
5963 it (" returns nil if the command has a non zero exit code and no file in cache" , function ()
60- vim .fn .writefile ({ " 0.2.2" }, " ./tmp/elixir-tools-next-ls.txt" )
64+ vim .fn .mkdir (" ./tmp/version-cache" , " p" )
65+ vim .fn .writefile ({ " 0.2.2" }, " ./tmp/version-cache/elixir-tools-next-ls.txt" )
6166 local result = utils .latest_release (
6267 " elixir-tools" ,
6368 " next-ls" ,
64- { github_host = " localhost:9999" , cache_dir = " ./tmp/" }
69+ { github_host = " localhost:9999" , cache_dir = " ./tmp/version-cache/ " }
6570 )
6671
6772 assert .are .same (result , " 0.2.2" )
0 commit comments