@@ -53,7 +53,7 @@ ruleTester.run('prefer-ending-with-an-expect', rule, {
5353 code : dedent `
5454 test('verifies chained expect method call', () => {
5555 doSomething();
56-
56+
5757 tester
5858 .foo()
5959 .bar()
@@ -70,6 +70,10 @@ ruleTester.run('prefer-ending-with-an-expect', rule, {
7070 ` ,
7171 options : [ { assertFunctionNames : [ 'td.verify' ] } ] ,
7272 } ,
73+ {
74+ code : 'it("should pass", async () => expect(true).toBeDefined())' ,
75+ parserOptions : { ecmaVersion : 2017 } ,
76+ } ,
7377 {
7478 code : 'it("should pass", () => expect(true).toBeDefined())' ,
7579 options : [
@@ -92,6 +96,34 @@ ruleTester.run('prefer-ending-with-an-expect', rule, {
9296 expect(container.toHTML()).toContain('Hello Bob!');
9397 });
9498 ` ,
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+ } ,
95127 {
96128 code : dedent `
97129 describe('GET /user', function () {
@@ -280,6 +312,24 @@ ruleTester.run('prefer-ending-with-an-expect', rule, {
280312 } ,
281313 ] ,
282314 } ,
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+ } ,
283333 ] ,
284334} ) ;
285335
0 commit comments