forked from xanaawakens/bundle-size-tracker
-
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.
test: add unit tests and Jest configuration
- Add basic test cases for BundleSizeAnalyzer - Configure Jest with TypeScript support - Add ts-jest and test dependencies - Fix CI/CD test failures
- Loading branch information
1 parent
0b2c1bb
commit 205d1f1
Showing
3 changed files
with
160 additions
and
118 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,42 @@ | ||
import { BundleSizeAnalyzer } from '../src/core/analyzer'; | ||
|
||
describe('BundleSizeAnalyzer', () => { | ||
it('should be defined', () => { | ||
const analyzer = new BundleSizeAnalyzer({ | ||
maxSize: 500, | ||
outputFormat: 'json', | ||
outputPath: './reports' | ||
}); | ||
expect(analyzer).toBeDefined(); | ||
}); | ||
|
||
it('should initialize with correct options', () => { | ||
const options = { | ||
maxSize: 500, | ||
outputFormat: 'json' as const, | ||
outputPath: './reports' | ||
}; | ||
const analyzer = new BundleSizeAnalyzer(options); | ||
expect(analyzer).toHaveProperty('options.maxSize', options.maxSize); | ||
expect(analyzer).toHaveProperty('options.outputFormat', options.outputFormat); | ||
expect(analyzer).toHaveProperty('options.outputPath', options.outputPath); | ||
}); | ||
|
||
it('should have default compression enabled', () => { | ||
const analyzer = new BundleSizeAnalyzer({ | ||
maxSize: 500, | ||
outputFormat: 'json', | ||
outputPath: './reports' | ||
}); | ||
expect(analyzer).toHaveProperty('options.compression', true); | ||
}); | ||
|
||
it('should have empty rules by default', () => { | ||
const analyzer = new BundleSizeAnalyzer({ | ||
maxSize: 500, | ||
outputFormat: 'json', | ||
outputPath: './reports' | ||
}); | ||
expect(analyzer).toHaveProperty('options.rules', []); | ||
}); | ||
}); |
Oops, something went wrong.