Skip to content

Commit

Permalink
test(to-have-length): add optional chaining case (#1295)
Browse files Browse the repository at this point in the history
  • Loading branch information
hekystyle authored Dec 16, 2022
1 parent 90f2d18 commit 42ce29f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rules/__tests__/prefer-to-have-length.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { espreeParser } from './test-utils';
const ruleTester = new TSESLint.RuleTester({
parser: espreeParser,
parserOptions: {
ecmaVersion: 2015,
ecmaVersion: 2020,
},
});

Expand All @@ -16,6 +16,7 @@ ruleTester.run('prefer-to-have-length', rule, {
'expect(files).toHaveLength(1);',
"expect(files.name).toBe('file');",
"expect(files[`name`]).toBe('file');",
'expect(users[0]?.permissions?.length).toBe(1);',
'expect(result).toBe(true);',
`expect(user.getUserName(5)).resolves.toEqual('Paul')`,
`expect(user.getUserName(5)).rejects.toEqual('Paul')`,
Expand Down

0 comments on commit 42ce29f

Please sign in to comment.