mirror of
https://github.com/AmberGraceRblx/luau-promise.git
synced 2025-06-19 21:59:17 +00:00
Update init.spec.lua
This commit is contained in:
parent
3a96a1d2a7
commit
7dd656dede
1 changed files with 16 additions and 1 deletions
|
@ -201,6 +201,21 @@ return function()
|
||||||
advanceTime(1)
|
advanceTime(1)
|
||||||
expect(promise:getStatus()).to.equal(Promise.Status.Resolved)
|
expect(promise:getStatus()).to.equal(Promise.Status.Resolved)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("Should allow for delays to be cancelled", function()
|
||||||
|
local promise = Promise.delay(2)
|
||||||
|
|
||||||
|
Promise.delay(1):andThen(function()
|
||||||
|
promise:cancel()
|
||||||
|
end)
|
||||||
|
|
||||||
|
expect(promise:getStatus()).to.equal(Promise.Status.Started)
|
||||||
|
advanceTime()
|
||||||
|
expect(promise:getStatus()).to.equal(Promise.Status.Started)
|
||||||
|
advanceTime(1)
|
||||||
|
expect(promise:getStatus()).to.equal(Promise.Status.Cancelled)
|
||||||
|
advanceTime(1)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("Promise.resolve", function()
|
describe("Promise.resolve", function()
|
||||||
|
@ -1498,4 +1513,4 @@ return function()
|
||||||
expect(promise._values[1]).to.equal("foo")
|
expect(promise._values[1]).to.equal("foo")
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue