gopher.nvim/spec/integration/json2go_test.lua
Oleksandr Smirnov 6a3924cee5
feat: json2go (#130)
* feat(json2go): implement

* feat(json2go): support manual input

* chore(readme): add json2go

* chore(docs): add docs
2025-12-08 21:29:34 +02:00

25 lines
684 B
Lua

local t = require "spec.testutils"
local child, T, json2go = t.setup "json2go"
json2go["should convert interativly"] = function()
local rs = t.setup_test("json2go/interativly", child, { 2, 0 })
child.cmd "GoJson"
child.type_keys [[{"json": true}]]
child.type_keys "<Esc>"
child.cmd "wq" -- quit prompt
child.cmd "write" -- the fixture file
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
t.cleanup(rs)
end
json2go["should convert argument"] = function()
local rs = t.setup_test("json2go/manual", child, { 2, 0 })
child.cmd [[GoJson {"user": {"name": "user-ovic"}}]]
child.cmd "write"
t.eq(t.readfile(rs.tmp), rs.fixtures.output)
t.cleanup(rs)
end
return T