@@ -53,7 +53,7 @@ ruleTester.run('prefer-ending-with-an-expect', rule, {
53
53
code : dedent `
54
54
test('verifies chained expect method call', () => {
55
55
doSomething();
56
-
56
+
57
57
tester
58
58
.foo()
59
59
.bar()
@@ -70,6 +70,10 @@ ruleTester.run('prefer-ending-with-an-expect', rule, {
70
70
` ,
71
71
options : [ { assertFunctionNames : [ 'td.verify' ] } ] ,
72
72
} ,
73
+ {
74
+ code : 'it("should pass", async () => expect(true).toBeDefined())' ,
75
+ parserOptions : { ecmaVersion : 2017 } ,
76
+ } ,
73
77
{
74
78
code : 'it("should pass", () => expect(true).toBeDefined())' ,
75
79
options : [
@@ -92,6 +96,34 @@ ruleTester.run('prefer-ending-with-an-expect', rule, {
92
96
expect(container.toHTML()).toContain('Hello Bob!');
93
97
});
94
98
` ,
99
+ {
100
+ code : dedent `
101
+ it('is a complete test', async () => {
102
+ const container = render(Greeter);
103
+
104
+ expect(container).toBeDefined();
105
+
106
+ container.setProp('name', 'Bob');
107
+
108
+ await expect(container.toHTML()).resolve.toContain('Hello Bob!');
109
+ });
110
+ ` ,
111
+ parserOptions : { ecmaVersion : 2017 } ,
112
+ } ,
113
+ {
114
+ code : dedent `
115
+ it('is a complete test', async function () {
116
+ const container = render(Greeter);
117
+
118
+ expect(container).toBeDefined();
119
+
120
+ container.setProp('name', 'Bob');
121
+
122
+ await expect(container.toHTML()).resolve.toContain('Hello Bob!');
123
+ });
124
+ ` ,
125
+ parserOptions : { ecmaVersion : 2017 } ,
126
+ } ,
95
127
{
96
128
code : dedent `
97
129
describe('GET /user', function () {
@@ -280,6 +312,24 @@ ruleTester.run('prefer-ending-with-an-expect', rule, {
280
312
} ,
281
313
] ,
282
314
} ,
315
+ {
316
+ code : dedent `
317
+ it('is a complete test', async () => {
318
+ const container = render(Greeter);
319
+
320
+ await expect(container).toBeDefined();
321
+
322
+ await container.setProp('name', 'Bob');
323
+ });
324
+ ` ,
325
+ parserOptions : { ecmaVersion : 2017 } ,
326
+ errors : [
327
+ {
328
+ messageId : 'mustEndWithExpect' ,
329
+ type : AST_NODE_TYPES . Identifier ,
330
+ } ,
331
+ ] ,
332
+ } ,
283
333
] ,
284
334
} ) ;
285
335
0 commit comments