-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdescribe.lua
More file actions
59 lines (51 loc) · 1.88 KB
/
describe.lua
File metadata and controls
59 lines (51 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
local Nocturne = require(script.Parent.Nocturne)
describe("Nocturne", function()
local nocturne
beforeEach(function()
nocturne = Nocturne.new()
nocturne:initialize()
end)
it("should load an asset", function()
local assetId = "testAsset"
local asset = nocturne:loadAsset(assetId)
expect(asset).to.be.ok()
expect(nocturne.loadedAssets[assetId]).to.equal(asset)
end)
it("should unload an asset", function()
local assetId = "testAsset"
nocturne:loadAsset(assetId)
nocturne:unloadAsset(assetId)
expect(nocturne.loadedAssets[assetId]).to.never.be.ok()
end)
it("should return the correct asset count", function()
nocturne:loadAsset("asset1")
nocturne:loadAsset("asset2")
expect(nocturne:getAssetCount()).to.equal(2)
end)
it("should fire a remote event", function()
local eventName = "testEvent"
nocturne.remotes[eventName] = Instance.new("RemoteEvent")
local success = pcall(function()
nocturne:fireRemoteEvent(eventName, "arg1", "arg2")
end)
expect(success).to.be.ok()
end)
it("should connect to a remote event", function()
local eventName = "testEvent"
nocturne.remotes[eventName] = Instance.new("RemoteEvent")
local success = pcall(function()
nocturne:connectRemoteEvent(eventName, function() end)
end)
expect(success).to.be.ok()
end)
it("should disconnect from a remote event", function()
local eventName = "testEvent"
nocturne.remotes[eventName] = Instance.new("RemoteEvent")
local callback = function() end
nocturne:connectRemoteEvent(eventName, callback)
local success = pcall(function()
nocturne:disconnectRemoteEvent(eventName, callback)
end)
expect(success).to.be.ok()
end)
end)