Skip to content

Commit

Permalink
fix: CI/CD test failures
Browse files Browse the repository at this point in the history
test: add unit tests and Jest configuration
  • Loading branch information
xanaawakens authored Jan 2, 2025
2 parents 625ab1e + 205d1f1 commit 03d0f5c
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 118 deletions.
42 changes: 42 additions & 0 deletions __tests__/core.test.ts
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', []);
});
});
Loading

0 comments on commit 03d0f5c

Please sign in to comment.