Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

test: assert the guide and draw call exist instead of chaining optionally

Luis Ortizf42fb5e16054
diff --git a/packages/core/src/guides/__tests__/import-guide.test.ts b/packages/core/src/guides/__tests__/import-guide.test.ts
index 6572890..c219287 100644
--- a/packages/core/src/guides/__tests__/import-guide.test.ts
+++ b/packages/core/src/guides/__tests__/import-guide.test.ts
@@ -109,7 +109,7 @@ describe('importGuide', () => {
it('points each step at its own newly minted screenshot', async () => {
const guideId = await importGuide(makeBundle());
const loaded = await getGuide(guideId);
- const [first, second] = loaded?.steps as Step[];
+ const [first, second] = loaded!.steps as Step[];
const screenshot = loaded?.screenshots.get(first!.id);
expect(screenshot?.id).toBe(first!.screenshotId);
diff --git a/packages/core/src/screenshot/__tests__/render.test.ts b/packages/core/src/screenshot/__tests__/render.test.ts
index 4798627..086b82f 100644
--- a/packages/core/src/screenshot/__tests__/render.test.ts
+++ b/packages/core/src/screenshot/__tests__/render.test.ts
@@ -108,7 +108,7 @@ describe('renderScreenshot', () => {
const s = makeScreenshot({ edits: { viewport: { x: 100, y: 50, width: 600, height: 400 } } });
await renderScreenshot(s);
- const [, sx, sy, sw, sh, dx, dy, dw, dh] = calls.find((c) => c.m === 'drawImage')?.a as number[];
+ const [, sx, sy, sw, sh, dx, dy, dw, dh] = calls.find((c) => c.m === 'drawImage')!.a as number[];
expect([sx, sy, sw, sh]).toEqual([100, 50, 600, 400]);
expect([dx, dy, dw, dh]).toEqual([0, 0, 600, 400]);
});