chore: prepare release, set up workflows

This commit is contained in:
Richard 2024-10-12 17:46:07 -07:00
parent 0416717f6c
commit a5d38b0d6d
58 changed files with 261 additions and 110 deletions

View file

@ -8,39 +8,39 @@ local renderHook = require(script.Parent.Parent.utils.renderHook)
return function()
it("tracks atom state", function()
local source = atom(0)
local state = atom(0)
local hook = renderHook(function()
return useAtom(source)
return useAtom(state)
end)
expect(hook.result).to.equal(0)
source(1)
state(1)
expect(hook.result).to.equal(1)
end)
it("accepts a molecule", function()
local source = atom(0)
local state = atom(0)
local hook = renderHook(function()
return useAtom(function()
return 2 * source()
return 2 * state()
end)
end)
expect(hook.result).to.equal(0)
source(1)
state(1)
expect(hook.result).to.equal(2)
end)
it("tracks dependencies", function()
local source = atom(0)
local state = atom(0)
local hook = renderHook(function()
return useAtom(source, { source })
return useAtom(state, { state })
end)
expect(hook.result).to.equal(0)
source(1)
state(1)
expect(hook.result).to.equal(1)
source = atom(0)
state = atom(0)
hook.rerender()
expect(hook.result).to.equal(0)
source(1)
state(1)
expect(hook.result).to.equal(1)
end)
end