Files
smoothschedule/activepieces-fork/packages/pieces/community/pdf/test/extract-pdf-pages.test.ts
poduck 3aa7199503 Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece
- Create integrations app with Activepieces service layer
- Add embed token endpoint for iframe integration
- Create Automations page with embedded workflow builder
- Add sidebar visibility fix for embed mode
- Add list inactive customers endpoint to Public API
- Include SmoothSchedule triggers: event created/updated/cancelled
- Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 22:59:37 -05:00

60 lines
1.6 KiB
TypeScript

import { pageRangeToIndexes } from './../src/lib/actions/extract-pdf-pages';
describe('pageRangeToIndexes', () => {
test('should throw error if start more than end', () => {
expect(() => {
pageRangeToIndexes(5, 3, 10);
}).toThrow();
});
test('should throw error on start 0', () => {
expect(() => {
pageRangeToIndexes(0, 10, 10);
}).toThrow();
});
test('should throw error on end 0', () => {
expect(() => {
pageRangeToIndexes(0, 10, 10);
}).toThrow();
});
test('should throw error if start more than total pages', () => {
expect(() => {
pageRangeToIndexes(10, 10, 5);
}).toThrow();
});
test('should throw error if end more than total pages', () => {
expect(() => {
pageRangeToIndexes(1, 11, 5);
}).toThrow();
});
test('should throw error start negative when end positive', () => {
expect(() => {
pageRangeToIndexes(-1, 4, 10);
}).toThrow();
});
test('should succeed with positive range', () => {
const indexes = pageRangeToIndexes(1, 4, 10);
expect(indexes).toStrictEqual([0, 1, 2, 3]);
});
test('should succeed with positive range of 1 value', () => {
const indexes = pageRangeToIndexes(5, 5, 10);
expect(indexes).toStrictEqual([4]);
});
test('should succeed with negative range', () => {
const indexes = pageRangeToIndexes(-4, -1, 10);
expect(indexes).toStrictEqual([6, 7, 8, 9]);
});
test('should succeed with negative range of 1 value', () => {
const indexes = pageRangeToIndexes(-5, -5, 10);
expect(indexes).toStrictEqual([5]);
});
});