-
Notifications
You must be signed in to change notification settings - Fork 3
/
expectation.go
60 lines (46 loc) · 1.28 KB
/
expectation.go
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
60
package jasmine
import "github.com/gopherjs/gopherjs/js"
type Expectation struct {
o *js.Object
Not *Expectation `js:"not"`
}
func (e *Expectation) ToBe(value interface{}) {
e.o.Call("toBe", value)
}
func (e *Expectation) ToEqual(value interface{}) {
e.o.Call("toEqual", value)
}
// ToMatch is not able to match against a regex at the moment
func (e *Expectation) ToMatch(value interface{}) {
e.o.Call("toMatch", value)
}
// ToBeDefined checks if the expectation is defined
func (e *Expectation) ToBeDefined() {
e.o.Call("toBeDefined")
}
// ToBeUndefined checks if the expectation is undefined
func (e *Expectation) ToBeUndefined() {
e.o.Call("toBeUndefined")
}
// ToBeNull checks if the expectation to be null / nil
func (e *Expectation) ToBeNull() {
e.o.Call("toBeNull")
}
func (e *Expectation) ToBeTruthy() {
e.o.Call("toBeTruthy")
}
func (e *Expectation) ToBeFalsy() {
e.o.Call("toBeFalsy")
}
func (e *Expectation) ToContain(value interface{}) {
e.o.Call("toContain", value)
}
func (e *Expectation) ToBeLessThan(value interface{}) {
e.o.Call("toBeLessThan", value)
}
func (e *Expectation) ToBeGreaterThan(value interface{}) {
e.o.Call("toBeGreaterThan", value)
}
func (e *Expectation) ToBeCloseTo(value interface{}, percision int) {
e.o.Call("toBeCloseTo", value, percision)
}