-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(detector): test cases structure
- Loading branch information
Showing
3 changed files
with
28 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export const IF_STATEMENT = 'if-statement'; | ||
export const FOR_OF = 'for-of-statement'; | ||
export const FOR_IN = 'for-in-statement'; | ||
export const FOR = 'for-statement'; | ||
export const TIMEOUT = 'timeout'; | ||
export const CONSOLE = 'console-statement'; | ||
export const MOCKERY = 'excessive-jest-mock'; | ||
|
||
export const JAVASCRIPT = 'javascript'; | ||
export const TYPESCRIPT = 'typescript'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { describe, expect, test } from 'vitest'; | ||
import { SmellDetector } from '../src/index'; | ||
import { TYPESCRIPT } from './smells-detector-builder'; | ||
|
||
describe('Smelly Test Smell Detection Suite', () => { | ||
test.each([{ | ||
code: ` | ||
jest.mock("../");`, | ||
language: TYPESCRIPT, | ||
} | ||
])(`detect code without smells`, ({ code, language }) => { | ||
const smellDetector = new SmellDetector(code, language); | ||
const result = smellDetector.findAll(); | ||
|
||
expect(result.length).toEqual(0); | ||
}); | ||
}); |