mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-02 10:35:22 +00:00
Fix tests
This commit is contained in:
parent
297071b4ab
commit
00b4d148bb
@ -146,41 +146,6 @@ describe('useConvertParameters', () => {
|
||||
expect(result.current.validateParameters()).toBe(false);
|
||||
});
|
||||
|
||||
test('should validate DPI ranges for image conversions', () => {
|
||||
const { result } = renderHook(() => useConvertParameters());
|
||||
|
||||
act(() => {
|
||||
result.current.updateParameter('fromExtension', 'pdf');
|
||||
result.current.updateParameter('toExtension', 'png');
|
||||
result.current.updateParameter('imageOptions', {
|
||||
colorType: 'color',
|
||||
dpi: 50, // Below minimum
|
||||
singleOrMultiple: 'multiple'
|
||||
});
|
||||
});
|
||||
|
||||
expect(result.current.validateParameters()).toBe(false);
|
||||
|
||||
act(() => {
|
||||
result.current.updateParameter('imageOptions', {
|
||||
colorType: 'color',
|
||||
dpi: 300, // Valid range
|
||||
singleOrMultiple: 'multiple'
|
||||
});
|
||||
});
|
||||
|
||||
expect(result.current.validateParameters()).toBe(true);
|
||||
|
||||
act(() => {
|
||||
result.current.updateParameter('imageOptions', {
|
||||
colorType: 'color',
|
||||
dpi: 700, // Above maximum
|
||||
singleOrMultiple: 'multiple'
|
||||
});
|
||||
});
|
||||
|
||||
expect(result.current.validateParameters()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Endpoint Generation', () => {
|
||||
|
@ -29,7 +29,7 @@ describe('useConvertParameters - Auto Detection & Smart Conversion', () => {
|
||||
test('should handle unknown file types with file-to-pdf fallback', () => {
|
||||
const { result } = renderHook(() => useConvertParameters());
|
||||
|
||||
const unknownFile = [{ name: 'document.xyz' }];
|
||||
const unknownFile = [{ name: 'document.xyz' }, { name: 'image.jpggg' }];
|
||||
|
||||
act(() => {
|
||||
result.current.analyzeFileTypes(unknownFile);
|
||||
@ -37,7 +37,7 @@ describe('useConvertParameters - Auto Detection & Smart Conversion', () => {
|
||||
|
||||
expect(result.current.parameters.fromExtension).toBe('any');
|
||||
expect(result.current.parameters.toExtension).toBe('pdf'); // Fallback to file-to-pdf
|
||||
expect(result.current.parameters.isSmartDetection).toBe(false);
|
||||
expect(result.current.parameters.isSmartDetection).toBe(true);
|
||||
});
|
||||
|
||||
test('should handle files without extensions', () => {
|
||||
|
@ -102,7 +102,7 @@ describe('Convert Tool - Smart Detection Integration Tests', () => {
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(paramsResult.current.parameters.fromExtension).toBe('any');
|
||||
expect(paramsResult.current.parameters.fromExtension).toBe('file-xyz');
|
||||
expect(paramsResult.current.parameters.toExtension).toBe('pdf'); // Fallback
|
||||
expect(paramsResult.current.parameters.isSmartDetection).toBe(false);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user