Skip to content

Commit 166e92a

Browse files
committed
add: chai javascript snippets
1 parent 25a0e2b commit 166e92a

File tree

55 files changed

+407
-228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+407
-228
lines changed

snippets/js/tests/README.md

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,12 @@
77
- before
88
- describe
99
- it
10-
- [BDD](bdd/) (expect)
11-
- toBeCloseTo
12-
- toBeContain
13-
- toBeDefined
14-
- toBeFalsy
15-
- toBeGreaterThan
16-
- toBeLessThan
17-
- toBeNaN
18-
- toBeNull
19-
- toBeTruthy
20-
- toBeUndefined
21-
- toBe
22-
- toEqual
23-
- toHaveBeenCalledTimes
24-
- toHaveBeenCalledWith
25-
- toHaveBeenCalled
26-
- toMatch
27-
- toThrowError
28-
- toThrow
10+
- [BDD](bdd/)
11+
- expect
12+
- chai
13+
- jasmine
14+
- should
15+
- chai
2916
- [TDD](tdd/) (assert)
30-
- assert
31-
- ok
32-
- deepEqual
33-
- deepStrictEqual
34-
- doesNotThrow
35-
- equal
36-
- fail
37-
- ifError
38-
- notDeepEqual
39-
- notDeepStrictEqual
40-
- notEqual
41-
- notStrictEqual
42-
- strictEqual
43-
- throws
17+
- chai
18+
- node

snippets/js/tests/bdd/README.md

Lines changed: 2 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -2,110 +2,5 @@
22

33
## Prefix `tb.*`
44

5-
### [tb.closeto] toBeCloseTo
6-
7-
```javascript
8-
expect(${1}).toBeCloseTo(${2}, ${3});
9-
```
10-
11-
### [tb.contain] toBeContain
12-
13-
```javascript
14-
expect(${1}).toBeContain(${2});
15-
```
16-
17-
### [tb.defined] toBeDefined
18-
19-
```javascript
20-
expect(${1}).toBeDefined();
21-
```
22-
23-
### [tb.falsy] toBeFalsy
24-
25-
```javascript
26-
expect(${1}).toBeFalsy();
27-
```
28-
29-
### [tb.greaterthan] toBeGreaterThan
30-
31-
```javascript
32-
expect(${1}).toBeGreaterThan(${2});
33-
```
34-
35-
### [tb.lessthan] toBeLessThan
36-
37-
```javascript
38-
expect(${1}).toBeLessThan(${2});
39-
```
40-
41-
### [tb.nan] toBeNaN
42-
43-
```javascript
44-
expect(${1}).toBeNaN();
45-
```
46-
47-
### [tb.null] toBeNull
48-
49-
```javascript
50-
expect(${1}).toBeNull();
51-
```
52-
53-
### [tb.truthy] toBeTruthy
54-
55-
```javascript
56-
expect(${1}).toBeTruthy();
57-
```
58-
59-
### [tb.undefined] toBeUndefined
60-
61-
```javascript
62-
expect(${1}).toBeUndefined();
63-
```
64-
65-
### [tb.tobe] toBe
66-
67-
```javascript
68-
expect(${1}).toBe(${2});
69-
```
70-
71-
### [tb.equal] toEqual
72-
73-
```javascript
74-
expect(${1}).toEqual(${2});
75-
```
76-
77-
### [tb.hbctimes] toHaveBeenCalledTimes
78-
79-
```javascript
80-
expect(${1}).toHaveBeenCalledTimes(${2});
81-
```
82-
83-
### [tb.hbcwith] toHaveBeenCalledWith
84-
85-
```javascript
86-
expect(${1}).toHaveBeenCalledWith(${2}, ${3});
87-
```
88-
89-
### [tb.hbc] toHaveBeenCalled
90-
91-
```javascript
92-
expect(${1}).toHaveBeenCalled();
93-
```
94-
95-
### [tb.match] toMatch
96-
97-
```javascript
98-
expect(${1}).toMatch(${2});
99-
```
100-
101-
### [tb.throwerror] toThrowError
102-
103-
```javascript
104-
expect(${1}).toThrowError(${2});
105-
```
106-
107-
### [tb.throw] toThrow
108-
109-
```javascript
110-
expect(${1}).toThrow(${2});
111-
```
5+
- [Expect](expect/)
6+
- [Should](should/)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Expect JavaScript Snippets
2+
3+
- [Chai](chai/)
4+
- to.be.a
5+
- to.equal
6+
- to.have.length
7+
- to.have.property
8+
- [Jasmine](jasmine/)
9+
- toBeCloseTo
10+
- toBeContain
11+
- toBeDefined
12+
- toBeFalsy
13+
- toBeGreaterThan
14+
- toBeLessThan
15+
- toBeNaN
16+
- toBeNull
17+
- toBeTruthy
18+
- toBeUndefined
19+
- toBe
20+
- toEqual
21+
- toHaveBeenCalledTimes
22+
- toHaveBeenCalledWith
23+
- toHaveBeenCalled
24+
- toMatch
25+
- toThrowError
26+
- toThrow
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Chai Expect JavaScript Snippets
2+
3+
### [tb.tobea] to.be.a
4+
5+
```javascript
6+
expect(${1}).to.be.a(${2});
7+
```
8+
9+
### [tb.toequal] to.equal
10+
11+
```javascript
12+
expect(${1}).to.equal(${2});
13+
```
14+
15+
### [tb.tohl] to.have.length
16+
17+
```javascript
18+
expect(${1}).to.have.length(${2});
19+
```
20+
21+
### [tb.tohp] to.have.property
22+
23+
```javascript
24+
expect(${1}).to.have.property(${2}).with.length(${3});
25+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<snippet>
2+
<content><![CDATA[
3+
expect(${1}).to.be.a(${2});
4+
]]></content>
5+
<tabTrigger>tb.tobea</tabTrigger>
6+
<description>tb - Expect to.be.a</description>
7+
</snippet>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<snippet>
2+
<content><![CDATA[
3+
expect(${1}).to.equal(${2});
4+
]]></content>
5+
<tabTrigger>tb.toequal</tabTrigger>
6+
<description>tb - Expect to.equal</description>
7+
</snippet>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<snippet>
2+
<content><![CDATA[
3+
expect(${1}).to.have.length(${2});
4+
]]></content>
5+
<tabTrigger>tb.tohl</tabTrigger>
6+
<description>tb - Expect to.have.length</description>
7+
</snippet>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<snippet>
2+
<content><![CDATA[
3+
expect(${1}).to.have.property(${2}).with.length(${3});
4+
]]></content>
5+
<tabTrigger>tb.tohp</tabTrigger>
6+
<description>tb - Expect to.have.property</description>
7+
</snippet>
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Jasmine Expect JavaScript Snippets
2+
3+
### [tb.closeto] toBeCloseTo
4+
5+
```javascript
6+
expect(${1}).toBeCloseTo(${2}, ${3});
7+
```
8+
9+
### [tb.contain] toBeContain
10+
11+
```javascript
12+
expect(${1}).toBeContain(${2});
13+
```
14+
15+
### [tb.defined] toBeDefined
16+
17+
```javascript
18+
expect(${1}).toBeDefined();
19+
```
20+
21+
### [tb.falsy] toBeFalsy
22+
23+
```javascript
24+
expect(${1}).toBeFalsy();
25+
```
26+
27+
### [tb.greaterthan] toBeGreaterThan
28+
29+
```javascript
30+
expect(${1}).toBeGreaterThan(${2});
31+
```
32+
33+
### [tb.lessthan] toBeLessThan
34+
35+
```javascript
36+
expect(${1}).toBeLessThan(${2});
37+
```
38+
39+
### [tb.nan] toBeNaN
40+
41+
```javascript
42+
expect(${1}).toBeNaN();
43+
```
44+
45+
### [tb.null] toBeNull
46+
47+
```javascript
48+
expect(${1}).toBeNull();
49+
```
50+
51+
### [tb.truthy] toBeTruthy
52+
53+
```javascript
54+
expect(${1}).toBeTruthy();
55+
```
56+
57+
### [tb.undefined] toBeUndefined
58+
59+
```javascript
60+
expect(${1}).toBeUndefined();
61+
```
62+
63+
### [tb.tobe] toBe
64+
65+
```javascript
66+
expect(${1}).toBe(${2});
67+
```
68+
69+
### [tb.equal] toEqual
70+
71+
```javascript
72+
expect(${1}).toEqual(${2});
73+
```
74+
75+
### [tb.hbctimes] toHaveBeenCalledTimes
76+
77+
```javascript
78+
expect(${1}).toHaveBeenCalledTimes(${2});
79+
```
80+
81+
### [tb.hbcwith] toHaveBeenCalledWith
82+
83+
```javascript
84+
expect(${1}).toHaveBeenCalledWith(${2}, ${3});
85+
```
86+
87+
### [tb.hbc] toHaveBeenCalled
88+
89+
```javascript
90+
expect(${1}).toHaveBeenCalled();
91+
```
92+
93+
### [tb.match] toMatch
94+
95+
```javascript
96+
expect(${1}).toMatch(${2});
97+
```
98+
99+
### [tb.throwerror] toThrowError
100+
101+
```javascript
102+
expect(${1}).toThrowError(${2});
103+
```
104+
105+
### [tb.throw] toThrow
106+
107+
```javascript
108+
expect(${1}).toThrow(${2});
109+
```

0 commit comments

Comments
 (0)