Skip to content

Commit

Permalink
Document Type LSHandler factory uses list of UTI's
Browse files Browse the repository at this point in the history
  • Loading branch information
targendaz2 committed Apr 23, 2024
1 parent dbf0088 commit a1a5655
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 18 additions & 0 deletions tests/factories/data/utis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
"com.adobe.pdf",
"com.microsoft.excel.xls",
"com.microsoft.powerpoint.ppt",
"com.microsoft.word.doc",
"public.audio",
"public.html",
"public.jpeg",
"public.movie",
"public.mp3",
"public.png",
"public.text",
"public.tiff",
"public.url",
"public.video",
"public.xhtml",
"public.xml"
]
4 changes: 3 additions & 1 deletion tests/factories/lsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
} from '@/src/types';
import roles from '@/tests/factories/data/roles.json';
import urlSchemes from '@/tests/factories/data/urlSchemes.json';
import utis from '@/tests/factories/data/utis.json';
import { faker } from '@faker-js/faker';
import { Factory } from 'fishery';

Expand Down Expand Up @@ -38,9 +39,10 @@ export const lsHandlerFactory = LSHandlerFactory.define(

if (transientParams.documentType) {
role = faker.helpers.arrayElement(roles);
const uti = faker.helpers.arrayElement(utis);

// @ts-expect-error 'ignoring implicit any error'
lsHandler['LSHandlerContentType'] = 'public.html';
lsHandler['LSHandlerContentType'] = uti;
} else if (transientParams.urlScheme) {
role = 'All';
const urlScheme = faker.helpers.arrayElement(urlSchemes);
Expand Down

0 comments on commit a1a5655

Please sign in to comment.