Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(PE-7090): return records as sorted entries #35

Merged
merged 9 commits into from
Nov 13, 2024
11 changes: 5 additions & 6 deletions .busted
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
print("Loading .busted configuration...")

return {
_all = {
default = {
root = "src",
pattern = "**/*_spec.lua$",
helper = "spec/setup.lua",
verbose = true,
coverage = true,
output = "utfTerminal",
jobs = 4,
},
default = {
ROOT = {"ant"},
pattern = "**/*_spec.lua$",
helper = "spec/setup.lua",
}
}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ node_modules
wallet.json
.DS_Store
luacov-html
.luacov
*.gz
luacov.stats.out
process.wasm
dist
publish-output.json
publish-output.json
luarocks-3.9.1
5 changes: 5 additions & 0 deletions .luacov
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
statsfile = 'coverage/luacov.stats.out';
reportfile = 'coverage/luacov.report.out';
deleteStatsFile = false;
include = { "src/" }
exclude = { "crypto", "json", "base64", "ao" }
9 changes: 9 additions & 0 deletions spec/ant_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ describe("Arweave Name Token", function()
assert.are.same(_G.Records["@"].ttlSeconds, 900)
end)

it("gets all records", function()
records.setRecord("zed", string.rep("1", 43), 3600)
records.setRecord("@", string.rep("1", 43), 3600)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - generally when testing you should avoid "using the tools your testing" - instead, set the records manually in global state using _G.Records = {} and then validate the behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point - 16220a9

local recordEntries = records.getRecords()

assert.are.same(recordEntries[1].name, "@")
assert.are.same(recordEntries[#recordEntries].name, "zed")
end)

it("removes a record", function()
local name = "@"
records.removeRecord(name) -- happy path
Expand Down
Loading