Skip to content

Commit

Permalink
create tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wd60622 committed Jan 9, 2025
1 parent 6b984ac commit 4858145
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions lua/tests/octo/gh_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
local gh = require "octo.gh"
local eq = assert.are.same

describe("gh", function()
it("booleans", function()
local args = {}
local opts = {
slurp = false,
paginate = true,
}
gh.insert_args(args, opts)
local expected = {
"--paginate",
}
eq(args, expected)
end)
it("single-char", function()
local args = {}
local opts = {
F = {
query = "query",
},
f = {
foo = "bar",
},
}
gh.insert_args(args, opts)
local expected = {
"-F",
"query=query",
"-f",
"foo=bar",
}
eq(args, expected)
end)
it("list", function()
local args = {}
local opts = {
f = {
items = { "a", "b", "c" },
},
}
gh.insert_args(args, opts)
local expected = {
"-f",
"items[]=a",
"-f",
"items[]=b",
"-f",
"items[]=c",
}
eq(args, expected)
end)
end)

0 comments on commit 4858145

Please sign in to comment.