mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-03-04 02:20:19 +01:00
Feature/v2/filewithid implementation (#4369)
Added Filewithid type Updated code where file was being used to use filewithid Updated places we identified files by name or composite keys to use UUID Updated places we should have been using quickkey Updated pageeditor issue where we parsed pagenumber from pageid instead of using pagenumber directly --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: James Brunton <jbrunton96@gmail.com>
This commit is contained in:
28
frontend/src/tests/utils/testFileHelpers.ts
Normal file
28
frontend/src/tests/utils/testFileHelpers.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Test utilities for creating StirlingFile objects in tests
|
||||
*/
|
||||
|
||||
import { StirlingFile, createStirlingFile } from '../../types/fileContext';
|
||||
|
||||
/**
|
||||
* Create a StirlingFile object for testing purposes
|
||||
*/
|
||||
export function createTestStirlingFile(
|
||||
name: string,
|
||||
content: string = 'test content',
|
||||
type: string = 'application/pdf'
|
||||
): StirlingFile {
|
||||
const file = new File([content], name, { type });
|
||||
return createStirlingFile(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create multiple StirlingFile objects for testing
|
||||
*/
|
||||
export function createTestFilesWithId(
|
||||
files: Array<{ name: string; content?: string; type?: string }>
|
||||
): StirlingFile[] {
|
||||
return files.map(({ name, content = 'test content', type = 'application/pdf' }) =>
|
||||
createTestStirlingFile(name, content, type)
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user