mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-03 02:11:07 +05:30
style: run prettier formatter over src and tests
This commit is contained in:
@@ -10,7 +10,7 @@ describe('PDFOperations Utilities', () => {
|
||||
// Test logic: parsing "1" should extract page index 0
|
||||
const input = '1';
|
||||
const pages = [0]; // Parsed result
|
||||
|
||||
|
||||
expect(pages.length).toBe(1);
|
||||
expect(pages[0]).toBe(0);
|
||||
});
|
||||
@@ -19,7 +19,7 @@ describe('PDFOperations Utilities', () => {
|
||||
// Test logic: parsing "1-3" should extract pages 0, 1, 2
|
||||
const input = '1-3';
|
||||
const pages = [0, 1, 2]; // Expected result
|
||||
|
||||
|
||||
expect(pages.length).toBe(3);
|
||||
expect(pages).toEqual([0, 1, 2]);
|
||||
});
|
||||
@@ -28,7 +28,7 @@ describe('PDFOperations Utilities', () => {
|
||||
// Test logic: parsing "1-2,4-5" should extract pages 0,1,3,4
|
||||
const input = '1-2,4-5';
|
||||
const pages = [0, 1, 3, 4]; // Expected result
|
||||
|
||||
|
||||
expect(pages.length).toBe(4);
|
||||
expect(pages).toEqual([0, 1, 3, 4]);
|
||||
});
|
||||
@@ -36,7 +36,7 @@ describe('PDFOperations Utilities', () => {
|
||||
it('should sort pages in ascending order', () => {
|
||||
const unsorted = [2, 0, 3, 1];
|
||||
const sorted = unsorted.sort((a, b) => a - b);
|
||||
|
||||
|
||||
expect(sorted).toEqual([0, 1, 2, 3]);
|
||||
});
|
||||
});
|
||||
@@ -45,14 +45,14 @@ describe('PDFOperations Utilities', () => {
|
||||
it('should validate hex color format', () => {
|
||||
const validHex = '#FF5733';
|
||||
const isValid = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.test(validHex);
|
||||
|
||||
|
||||
expect(isValid).toBe(true);
|
||||
});
|
||||
|
||||
it('should detect invalid hex colors', () => {
|
||||
const invalidColors = ['#GG5733', '#12345', 'notahex'];
|
||||
|
||||
invalidColors.forEach(color => {
|
||||
|
||||
invalidColors.forEach((color) => {
|
||||
const isValid = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.test(color);
|
||||
expect(isValid).toBe(false);
|
||||
});
|
||||
@@ -73,12 +73,12 @@ describe('PDFOperations Utilities', () => {
|
||||
{ input: '-1', isValid: false },
|
||||
{ input: 'abc', isValid: false },
|
||||
{ input: '1', isValid: true },
|
||||
{ input: '5', isValid: true }
|
||||
{ input: '5', isValid: true },
|
||||
];
|
||||
|
||||
|
||||
testPages.forEach(({ input, isValid }) => {
|
||||
const num = parseInt(input);
|
||||
|
||||
|
||||
if (isNaN(num)) {
|
||||
// Non-numeric string
|
||||
expect(isValid).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user