Skip to content

Commit

Permalink
fix(no-unnecessary-act): report everything that's reported in non-str…
Browse files Browse the repository at this point in the history
…ict (#423)

* fix(no-unnecessary-act): report everything that's reported in non-strict

* refactor: remove duplication in tests

Co-authored-by: Michaël De Boey <info@michaeldeboey.be>

Closes #416
  • Loading branch information
zaicevas authored Jul 21, 2021
1 parent a8cc355 commit 840763d
Show file tree
Hide file tree
Showing 2 changed files with 514 additions and 495 deletions.
7 changes: 4 additions & 3 deletions lib/rules/no-unnecessary-act.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const RULE_NAME = 'no-unnecessary-act';
export type MessageIds =
| 'noUnnecessaryActEmptyFunction'
| 'noUnnecessaryActTestingLibraryUtil';
type Options = [{ isStrict: boolean }];
export type Options = [{ isStrict: boolean }];

export default createTestingLibraryRule<Options, MessageIds>({
name: RULE_NAME,
Expand Down Expand Up @@ -144,8 +144,9 @@ export default createTestingLibraryRule<Options, MessageIds>({
}

const shouldBeReported = isStrict
? hasSomeNonTestingLibraryCall(blockStatementNode.body) &&
hasTestingLibraryCall(blockStatementNode.body)
? (hasSomeNonTestingLibraryCall(blockStatementNode.body) &&
hasTestingLibraryCall(blockStatementNode.body)) ||
!hasSomeNonTestingLibraryCall(blockStatementNode.body)
: !hasSomeNonTestingLibraryCall(blockStatementNode.body);

if (shouldBeReported) {
Expand Down
Loading

0 comments on commit 840763d

Please sign in to comment.