Skip to content

Commit ab8e175

Browse files
committed
add: sinon assertions snippets
1 parent f33a18a commit ab8e175

25 files changed

+326
-5
lines changed

snippets/js/tests/sinon/README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,27 @@
22

33
## Prefix `ts.*`
44

5-
### [ts.]
6-
7-
```javascript
8-
9-
```
5+
- [Assertions](assertions/)
6+
- alwaysCalledOn
7+
- alwaysCalledWithExactly
8+
- alwaysCalledWithMatch
9+
- alwaysCalledWith
10+
- alwaysThrew
11+
- callCount
12+
- callOrder
13+
- calledOn
14+
- calledOnce
15+
- calledThrice
16+
- calledTwice
17+
- calledWithExactly
18+
- calledWithMatch
19+
- calledWith
20+
- called
21+
- expose
22+
- failException
23+
- fail
24+
- neverCalledWithMatch
25+
- neverCalledWith
26+
- notCalled
27+
- pass
28+
- threw
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Sinon JavaScript Snippets
2+
3+
## Assertions
4+
5+
### [ts.acon] alwaysCalledOn
6+
7+
```javascript
8+
sinon.assert.alwaysCalledOn(${1:spy}, ${2:obj});
9+
```
10+
11+
### [ts.acalledwe] alwaysCalledWithExactly
12+
13+
```javascript
14+
sinon.assert.alwaysCalledWithExactly(${1:spy}, ${2:arg1}${3:, arg2}${4:, ...});
15+
```
16+
17+
### [ts.acalledwm] alwaysCalledWithMatch
18+
19+
```javascript
20+
sinon.assert.alwaysCalledWithMatch(${1:spy}, ${2:arg1}${3:, arg2}${4:, ...});
21+
```
22+
23+
### [ts.acalledw] alwaysCalledWith
24+
25+
```javascript
26+
sinon.assert.alwaysCalledWith(${1:spy}, ${2:arg1}${3:, arg2}${4:, ...});
27+
```
28+
29+
### [ts.athrew] alwaysThrew
30+
31+
```javascript
32+
sinon.assert.alwaysThrew(${1:spy}, ${2:exception});
33+
```
34+
35+
### [ts.ccount] callCount
36+
37+
```javascript
38+
sinon.assert.callCount(${1:spy}, ${2:num});
39+
```
40+
41+
### [ts.corder] callOrder
42+
43+
```javascript
44+
sinon.assert.callOrder(${1:spy1}, ${2:spy2}${3:, ...});
45+
```
46+
47+
### [ts.con] calledOn
48+
49+
```javascript
50+
sinon.assert.calledOn(${1:spy}, ${2:obj});
51+
```
52+
53+
### [ts.calledo] calledOnce
54+
55+
```javascript
56+
sinon.assert.calledOnce(${1:spy});
57+
```
58+
59+
### [ts.calledth] calledThrice
60+
61+
```javascript
62+
sinon.assert.calledThrice(${1:spy});
63+
```
64+
65+
### [ts.calledt] calledTwice
66+
67+
```javascript
68+
sinon.assert.calledTwice(${1:spy});
69+
```
70+
71+
### [ts.calledwe] calledWithExactly
72+
73+
```javascript
74+
sinon.assert.calledWithExactly(${1:spy}, ${2:arg1}${3:, arg2}${4:, ...});
75+
```
76+
77+
### [ts.calledwm] calledWithMatch
78+
79+
```javascript
80+
sinon.assert.calledWithMatch(${1:spy}, ${2:arg1}${3:, arg2}${4:, ...});
81+
```
82+
83+
### [ts.] calledWith
84+
85+
```javascript
86+
sinon.assert.calledWith(${1:spy}, ${2:arg1}${3:, arg2}${4:, ...});
87+
```
88+
89+
### [ts.called] called
90+
91+
```javascript
92+
sinon.assert.called(${1:spy});
93+
```
94+
95+
### [ts.expose] expose
96+
97+
```javascript
98+
sinon.assert.expose(${1:object}, ${2:options});
99+
```
100+
101+
### [ts.faile] failException
102+
103+
```javascript
104+
sinon.assert.failException;
105+
```
106+
107+
### [ts.afail] fail
108+
109+
```javascript
110+
sinon.assert.fail(${1:message});
111+
```
112+
113+
### [ts.ncalledwm] neverCalledWithMatch
114+
115+
```javascript
116+
sinon.assert.neverCalledWithMatch(${1:spy}, ${2:arg1}${3:, arg2}${4:, ...});
117+
```
118+
119+
### [ts.ncalledw] neverCalledWith
120+
121+
```javascript
122+
sinon.assert.neverCalledWith(${1:spy}, ${2:arg1}${3:, arg2}${4:, ...});
123+
```
124+
125+
### [ts.ncalled] notCalled
126+
127+
```javascript
128+
sinon.assert.notCalled(${1:spy});
129+
```
130+
131+
### [ts.pass] pass
132+
133+
```javascript
134+
sinon.assert.pass(${1:assertion});
135+
```
136+
137+
### [ts.threw] threw
138+
139+
```javascript
140+
sinon.assert.threw(${1:spy}, ${2:exception});
141+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<snippet>
2+
<content><![CDATA[
3+
sinon.assert.alwaysCalledOn(${1:spy}, ${2:obj});
4+
]]></content>
5+
<tabTrigger>ts.acon</tabTrigger>
6+
<description>ts - Assert alwaysCalledOn</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+
sinon.assert.alwaysCalledWithExactly(${1:spy}, ${2:arg1}${3:, arg2}${4:, ...});
4+
]]></content>
5+
<tabTrigger>ts.acalledwe</tabTrigger>
6+
<description>ts - Assert alwaysCalledWithExactly</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+
sinon.assert.alwaysCalledWithMatch(${1:spy}, ${2:arg1}${3:, arg2}${4:, ...});
4+
]]></content>
5+
<tabTrigger>ts.acalledwm</tabTrigger>
6+
<description>ts - Assert alwaysCalledWithMatch</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+
sinon.assert.alwaysCalledWith(${1:spy}, ${2:arg1}${3:, arg2}${4:, ...});
4+
]]></content>
5+
<tabTrigger>ts.acalledw</tabTrigger>
6+
<description>ts - Assert alwaysCalledWith</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+
sinon.assert.alwaysThrew(${1:spy}, ${2:exception});
4+
]]></content>
5+
<tabTrigger>ts.athrew</tabTrigger>
6+
<description>ts - Assert alwaysThrew</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+
sinon.assert.callCount(${1:spy}, ${2:num});
4+
]]></content>
5+
<tabTrigger>ts.ccount</tabTrigger>
6+
<description>ts - Assert callCount</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+
sinon.assert.callOrder(${1:spy1}, ${2:spy2}${3:, ...});
4+
]]></content>
5+
<tabTrigger>ts.corder</tabTrigger>
6+
<description>ts - Assert callOrder</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+
sinon.assert.calledOn(${1:spy}, ${2:obj});
4+
]]></content>
5+
<tabTrigger>ts.con</tabTrigger>
6+
<description>ts - Assert calledOn</description>
7+
</snippet>

0 commit comments

Comments
 (0)