d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
80 lines
2.7 KiB
TypeScript
80 lines
2.7 KiB
TypeScript
/**
|
|
* @vitest-environment jsdom
|
|
*/
|
|
import { describe, expect, it } from 'vitest'
|
|
import { buildPresentation } from '@/lib/pptx-renderer/model/presentation'
|
|
import type { PptxFiles } from '@/lib/pptx-renderer/parser/zip-parser'
|
|
|
|
function createFiles(presentation: string): PptxFiles {
|
|
return {
|
|
contentTypes: '<Types />',
|
|
presentation,
|
|
presentationRels: `<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="slides/slide1.xml" />
|
|
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="slides/slide2.xml" />
|
|
</Relationships>`,
|
|
slides: new Map([
|
|
['ppt/slides/slide1.xml', createSlideXml()],
|
|
['ppt/slides/slide2.xml', createSlideXml()],
|
|
]),
|
|
slideRels: new Map([
|
|
['ppt/slides/_rels/slide1.xml.rels', '<Relationships />'],
|
|
['ppt/slides/_rels/slide2.xml.rels', '<Relationships />'],
|
|
]),
|
|
slideLayouts: new Map(),
|
|
slideLayoutRels: new Map(),
|
|
slideMasters: new Map(),
|
|
slideMasterRels: new Map(),
|
|
themes: new Map(),
|
|
media: new Map(),
|
|
charts: new Map(),
|
|
chartStyles: new Map(),
|
|
chartColors: new Map(),
|
|
diagramDrawings: new Map(),
|
|
}
|
|
}
|
|
|
|
function createPresentationXml(markers = ''): string {
|
|
return `<p:presentation xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" ${markers}>
|
|
<p:sldSz cx="9144000" cy="5143500" />
|
|
<p:sldIdLst>
|
|
<p:sldId id="256" r:id="rId2" />
|
|
<p:sldId id="257" r:id="rId1" />
|
|
</p:sldIdLst>
|
|
</p:presentation>`
|
|
}
|
|
|
|
function createSlideXml(): string {
|
|
return `<p:sld xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
|
|
<p:cSld>
|
|
<p:spTree>
|
|
<p:nvGrpSpPr><p:cNvPr id="1" name="" /><p:cNvGrpSpPr /><p:nvPr /></p:nvGrpSpPr>
|
|
<p:grpSpPr />
|
|
</p:spTree>
|
|
</p:cSld>
|
|
</p:sld>`
|
|
}
|
|
|
|
describe('buildPresentation', () => {
|
|
it('does not treat the standard wps namespace prefix as WPS Office', () => {
|
|
const presentation = buildPresentation(
|
|
createFiles(
|
|
createPresentationXml(
|
|
'xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape"'
|
|
)
|
|
)
|
|
)
|
|
|
|
expect(presentation.isWps).toBe(false)
|
|
})
|
|
|
|
it('orders slides by relationship id instead of numeric slide id', () => {
|
|
const presentation = buildPresentation(createFiles(createPresentationXml()))
|
|
|
|
expect(presentation.slides.map((slide) => slide.slidePath)).toEqual([
|
|
'ppt/slides/slide2.xml',
|
|
'ppt/slides/slide1.xml',
|
|
])
|
|
})
|
|
})
|