-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some unit tests via jest for the start
Fixes: #14
- Loading branch information
Showing
3 changed files
with
3,279 additions
and
27 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
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,26 @@ | ||
import { Builder } from '../../../Builder'; | ||
import JSRuleFinder from '../JSRuleFinder'; | ||
|
||
describe('JSRuleFinder', () => { | ||
it('should create js rule if it does not exist', () => { | ||
// tslint:disable-next-line | ||
const builder: Builder = {} as Builder; | ||
builder.config = { | ||
module: { rules: [] } | ||
}; | ||
const rule = new JSRuleFinder(builder).findAndCreateJSRule(); | ||
expect(rule).toHaveProperty('test'); | ||
}); | ||
|
||
it('should find js rule if it exists', () => { | ||
// tslint:disable-next-line | ||
const builder: Builder = {} as Builder; | ||
const regex = /\.js$/; | ||
builder.config = { | ||
module: { rules: [{ test: /abc/ }, { test: regex }, { test: /def/ }] } | ||
}; | ||
const rule = new JSRuleFinder(builder).findAndCreateJSRule(); | ||
expect(rule).toHaveProperty('test'); | ||
expect(rule.test).toEqual(regex); | ||
}); | ||
}); |
Oops, something went wrong.