Skip to content

Commit

Permalink
Add unit tests for Satchel
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanLua committed Jan 9, 2024
1 parent c279bab commit ae18c08
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/init.spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
return function()
local Satchel = require(script.Parent)

describe("Methods", function()
it("SetBackpackEnabled(false)", function()
Satchel:SetBackpackEnabled(false)
expect(Satchel:GetBackpackEnabled()).to.equal(false)
end)
it("SetBackpackEnabled(true)", function()
Satchel:SetBackpackEnabled(true)
expect(Satchel:GetBackpackEnabled()).to.equal(true)
end)
it("GetBackpackEnabled", function()
local getBackpackEnabled = Satchel:GetBackpackEnabled()
expect(getBackpackEnabled).to.be.a("boolean")
end)
it("IsOpened", function()
local isOpened = Satchel:IsOpened()
expect(isOpened).to.be.a("boolean")
end)
it("GetStateChangedEvent", function()
local getStateChangedEvent = Satchel:GetStateChangedEvent()
expect(getStateChangedEvent).to.be.a("userdata")
end)
end)
-- TODO: Fix these tests
describe("Events", function()
-- it("StateChanged", function()
-- Satchel.StateChanged.to.be.a("userdata")
-- end)
-- it("BackpackEmpty", function()
-- Satchel.BackpackEmpty.to.be.a("userdata")
-- end)
-- it("BackpackItemAdded", function()
-- Satchel.BackpackItemAdded.to.be.a("userdata")
-- end)
-- it("BackpackItemRemoved", function()
-- Satchel.BackpackItemRemoved.to.be.a("userdata")
-- end)
end)
end

0 comments on commit ae18c08

Please sign in to comment.