Skip to content

Commit

Permalink
chore(test): add utils test for validate arweave id
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Oct 14, 2024
1 parent c36c1b4 commit 65c1c8a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec/utils_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,17 @@ describe("utils.camelCase", function()
assert.are.equal(utils.camelCase(""), "")
end)
end)

describe("utils.validateArweaveId", function()
it("should throw an error for invalid Arweave IDs", function()
local invalid, error = pcall(utils.validateArweaveId, "invalid-arweave-id-123")
assert.is_false(invalid)
assert.is_equal(error, "Invalid Arweave ID")
end)

it("should not throw an error for a valid Arweave ID", function()
local valid, error = pcall(utils.validateArweaveId, "0E7Ai_rEQ326_vLtgB81XHViFsLlcwQNqlT9ap24uQI")
assert.is_true(valid)
assert.is_nil(error)
end)
end)

0 comments on commit 65c1c8a

Please sign in to comment.