Skip to content

Commit 8fc8b2e

Browse files
committed
test(files): guard required document format fixtures
1 parent 3eddd9a commit 8fc8b2e

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

‎apps/sim/lib/workspace-files/search/owners.integration.ts‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ import {
6868
} from '@/lib/workspace-files/search/index-state'
6969
import { indexWorkspaceFileForSearch } from '@/lib/workspace-files/search/indexing'
7070

71+
async function requireDocxFormat() {
72+
const format = await getE2BDocFormat('report.docx')
73+
if (!format) throw new Error('DOCX rendering format is required for this fixture')
74+
return format
75+
}
76+
7177
const storageRoot = mkdtempSync(join(tmpdir(), 'sim-file-owner-search-'))
7278
setUploadDirServer(storageRoot)
7379
const fixtures: {
@@ -776,7 +782,7 @@ describe('owner-scoped indexed file search on PostgreSQL and stored bytes', () =
776782
artifact,
777783
fileDocumentCacheIdentity(
778784
source,
779-
(await getE2BDocFormat('report.docx'))!,
785+
await requireDocxFormat(),
780786
'text/plain',
781787
fileDocumentInputIdentity(f.owner, [dependencyRow])
782788
)
@@ -873,7 +879,7 @@ describe('owner-scoped indexed file search on PostgreSQL and stored bytes', () =
873879
'docx',
874880
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
875881
artifact,
876-
fileDocumentCacheIdentity(source, (await getE2BDocFormat('transition.docx'))!, 'text/plain')
882+
fileDocumentCacheIdentity(source, await requireDocxFormat(), 'text/plain')
877883
)
878884
const input = { projectId: f.projectId, fileId: generated.file.id, maxBytes: 1_000_000 }
879885
const rendered = await readProjectFileArtifact.execute({ principal: f.reader, input })
@@ -996,7 +1002,7 @@ describe('owner-scoped indexed file search on PostgreSQL and stored bytes', () =
9961002
),
9971003
fileDocumentCacheIdentity(
9981004
source,
999-
(await getE2BDocFormat('report.docx'))!,
1005+
await requireDocxFormat(),
10001006
'text/plain',
10011007
fileDocumentInputIdentity(f.owner, [dependencyRow])
10021008
)
@@ -1007,7 +1013,7 @@ describe('owner-scoped indexed file search on PostgreSQL and stored bytes', () =
10071013
'docx',
10081014
fileDocumentCacheIdentity(
10091015
source,
1010-
(await getE2BDocFormat('report.docx'))!,
1016+
await requireDocxFormat(),
10111017
'text/plain',
10121018
fileDocumentInputIdentity(f.owner, [dependencyRow])
10131019
)
@@ -1089,7 +1095,7 @@ describe('owner-scoped indexed file search on PostgreSQL and stored bytes', () =
10891095
),
10901096
fileDocumentCacheIdentity(
10911097
source,
1092-
(await getE2BDocFormat('report.docx'))!,
1098+
await requireDocxFormat(),
10931099
'text/plain',
10941100
fileDocumentInputIdentity(f.owner, [dependencyRow])
10951101
)
@@ -1100,7 +1106,7 @@ describe('owner-scoped indexed file search on PostgreSQL and stored bytes', () =
11001106
'docx',
11011107
fileDocumentCacheIdentity(
11021108
source,
1103-
(await getE2BDocFormat('report.docx'))!,
1109+
await requireDocxFormat(),
11041110
'text/plain',
11051111
fileDocumentInputIdentity(f.owner, [dependencyRow])
11061112
)

0 commit comments

Comments
 (0)