made tests fast again
This commit is contained in:
parent
a6def38c59
commit
73dcbc537f
|
@ -1,9 +1,9 @@
|
||||||
package gobot
|
package gobot
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("Utils", func() {
|
var _ = Describe("Utils", func() {
|
||||||
|
@ -15,22 +15,18 @@ var _ = Describe("Utils", func() {
|
||||||
Context("when valid", func() {
|
Context("when valid", func() {
|
||||||
It("should execute function at every interval", func() {
|
It("should execute function at every interval", func() {
|
||||||
var i = 0
|
var i = 0
|
||||||
Every("500ms", func() {
|
Every("2ms", func() {
|
||||||
i = i + 1
|
i++
|
||||||
})
|
})
|
||||||
time.Sleep(600 * time.Millisecond)
|
time.Sleep(5 * time.Millisecond)
|
||||||
Expect(i).To(Equal(1))
|
Expect(2).To(Equal(i))
|
||||||
time.Sleep(600 * time.Millisecond)
|
|
||||||
Expect(i).To(Equal(2))
|
|
||||||
})
|
})
|
||||||
It("should execute function after specific interval", func() {
|
It("should execute function after specific interval", func() {
|
||||||
var i = 0
|
var i = 0
|
||||||
After("500ms", func() {
|
After("1ms", func() {
|
||||||
i = i + 1
|
i = i + 1
|
||||||
})
|
})
|
||||||
time.Sleep(600 * time.Millisecond)
|
time.Sleep(2 * time.Millisecond)
|
||||||
Expect(i).To(Equal(1))
|
|
||||||
time.Sleep(600 * time.Millisecond)
|
|
||||||
Expect(i).To(Equal(1))
|
Expect(i).To(Equal(1))
|
||||||
})
|
})
|
||||||
It("should Publish message to channel without blocking", func() {
|
It("should Publish message to channel without blocking", func() {
|
||||||
|
|
Loading…
Reference in New Issue