Skip to content

Commit

Permalink
test(to-have-length): add optional chaining case
Browse files Browse the repository at this point in the history
  • Loading branch information
hekystyle committed Dec 2, 2022
1 parent 7984bc2 commit e65f97a
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
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 e65f97a

Please sign in to comment.