Skip to content

AI-native design editor. Open-source Figma alternative.

chore(lint): fix unused test code

Danila Poyarkov9e4d7bee5d31
diff --git a/oxlint.json b/oxlint.json
index 1727d0534..26c93c833 100644
--- a/oxlint.json
+++ b/oxlint.json
@@ -196,48 +196,6 @@
"open-pencil/no-raw-console-format": "error"
}
},
- {
- "files": [
- "tests/e2e/autosave.spec.ts",
- "tests/e2e/color-picker/basic.spec.ts",
- "tests/e2e/context-menu/basic.spec.ts",
- "tests/e2e/layers/panel.spec.ts",
- "tests/e2e/pages/multi-page.spec.ts",
- "tests/e2e/properties/panel.spec.ts",
- "tests/engine/cli/eval.test.ts",
- "tests/engine/color/okhcl/ui-logic.test.ts",
- "tests/engine/color/solid-commit.test.ts",
- "tests/engine/editor/selection/alignment.test.ts",
- "tests/engine/editor/selection/properties.test.ts",
- "tests/engine/fig/export/text.test.ts",
- "tests/engine/fig/heavy/fixtures.test.ts",
- "tests/engine/fig/import/basic.test.ts",
- "tests/engine/fig/import/edge-cases.test.ts",
- "tests/engine/fig/import/instance-regressions.test.ts",
- "tests/engine/fig/import/property-integrity.test.ts",
- "tests/engine/fig/roundtrip/basic.test.ts",
- "tests/engine/fig/roundtrip/variables.test.ts",
- "tests/engine/hit-test/basic.test.ts",
- "tests/engine/hit-test/scope.test.ts",
- "tests/engine/kiwi/serialize-fixes.test.ts",
- "tests/engine/layout/auto-layout.test.ts",
- "tests/engine/mcp.test.ts",
- "tests/engine/mcp/stdio.test.ts",
- "tests/engine/render/canvas/silhouette-autopsy.test.ts",
- "tests/engine/scene-graph/basic.test.ts",
- "tests/engine/scene-graph/world-transform.test.ts",
- "tests/engine/svg/export.test.ts",
- "tests/engine/text/style-runs.test.ts",
- "tests/engine/tools/ai-adapter.test.ts",
- "tests/engine/tools/cli.test.ts",
- "tests/engine/tools/modify.test.ts",
- "tests/engine/tools/registry.test.ts",
- "tests/engine/visual-inner-shadow-counter.ts"
- ],
- "rules": {
- "no-unused-vars": "off"
- }
- },
{
"files": [
"tests/e2e/perf/basic.spec.ts",
diff --git a/tests/e2e/autosave.spec.ts b/tests/e2e/autosave.spec.ts
index 3afe31d51..493b097f4 100644
--- a/tests/e2e/autosave.spec.ts
+++ b/tests/e2e/autosave.spec.ts
@@ -42,7 +42,6 @@ test('autosave triggers after scene changes with a file handle', async () => {
// Inject the file handle into the store's internal state
// We do this by calling a save first to establish the handle
await page.evaluate(() => {
- const store = window.__OPEN_PENCIL_STORE__!
// Directly set the fileHandle via a test hook
// Since fileHandle is a closure variable, we need to trigger the save path
// The cleanest way: mock showSaveFilePicker to return our handle
diff --git a/tests/e2e/color-picker/basic.spec.ts b/tests/e2e/color-picker/basic.spec.ts
index 4a56e2fd2..05af45481 100644
--- a/tests/e2e/color-picker/basic.spec.ts
+++ b/tests/e2e/color-picker/basic.spec.ts
@@ -18,13 +18,6 @@ test.afterAll(async () => {
await page.close()
})
-async function getSelectedId() {
- return page.evaluate(() => {
- const store = window.__OPEN_PENCIL_STORE__!
- return [...store.state.selectedIds][0] ?? null
- })
-}
-
async function getSelectedFill() {
return page.evaluate(() => {
const store = window.__OPEN_PENCIL_STORE__!
diff --git a/tests/e2e/context-menu/basic.spec.ts b/tests/e2e/context-menu/basic.spec.ts
index 8d375ced7..d75a967aa 100644
--- a/tests/e2e/context-menu/basic.spec.ts
+++ b/tests/e2e/context-menu/basic.spec.ts
@@ -116,10 +116,10 @@ test('toggle visibility via context menu', async () => {
expect(hidden!.visible).toBe(false)
// Toggle back: select via store since invisible nodes can't be hit-tested
- await page.evaluate((id) => {
+ await page.evaluate(() => {
const store = window.__OPEN_PENCIL_STORE__!
store.toggleVisibility()
- }, nodeId)
+ })
await canvas.waitForRender()
const restored = await page.evaluate((id) => {
diff --git a/tests/e2e/layers/panel.spec.ts b/tests/e2e/layers/panel.spec.ts
index 6f11cc3dd..0edf93aea 100644
--- a/tests/e2e/layers/panel.spec.ts
+++ b/tests/e2e/layers/panel.spec.ts
@@ -1,4 +1,4 @@
-import { test, expect, type Page } from '@playwright/test'
+import { expect, test, type Page } from '@playwright/test'
import { CanvasHelper } from '#tests/helpers/canvas'
@@ -140,7 +140,6 @@ test('grouping updates layers', async () => {
await canvas.drawRect(800, 600, 60, 60)
await canvas.selectAll()
- const beforeCount = await getSelectedCount()
await page.keyboard.press('Meta+g')
await canvas.waitForRender()
diff --git a/tests/e2e/pages/multi-page.spec.ts b/tests/e2e/pages/multi-page.spec.ts
index b938194ab..be1b3ecf2 100644
--- a/tests/e2e/pages/multi-page.spec.ts
+++ b/tests/e2e/pages/multi-page.spec.ts
@@ -134,7 +134,6 @@ test('delete current page switches to adjacent', async () => {
})
test('rename page via store', async () => {
- const pages = await getPages()
const currentId = await getCurrentPageId()
await page.evaluate(
diff --git a/tests/e2e/properties/panel.spec.ts b/tests/e2e/properties/panel.spec.ts
index eddae8b1b..91eb92332 100644
--- a/tests/e2e/properties/panel.spec.ts
+++ b/tests/e2e/properties/panel.spec.ts
@@ -1,7 +1,7 @@
-import { test, expect, type Page } from '@playwright/test'
+import { expect, test, type Page } from '@playwright/test'
import { CanvasHelper } from '#tests/helpers/canvas'
-import { getSelectedNode, getPageChildren } from '#tests/helpers/store'
+import { getPageChildren, getSelectedNode } from '#tests/helpers/store'
let page: Page
let canvas: CanvasHelper
@@ -114,7 +114,7 @@ test('fill color can bind an existing variable', async () => {
await canvas.clearCanvas()
await canvas.drawRect(200, 200, 80, 80)
- const variableId = await page.evaluate(() => {
+ await page.evaluate(() => {
const store = window.__OPEN_PENCIL_STORE__!
const col = store.graph.createCollection('Colors')
const variable = store.graph.createVariable('test-brand-red', 'COLOR', col.id, {
diff --git a/tests/engine/cli/eval.test.ts b/tests/engine/cli/eval.test.ts
index 9c2c1c0e8..eec79f890 100644
--- a/tests/engine/cli/eval.test.ts
+++ b/tests/engine/cli/eval.test.ts
@@ -1,4 +1,4 @@
-import { describe, expect, test, setDefaultTimeout } from 'bun:test'
+import { expect, setDefaultTimeout, test } from 'bun:test'
import { randomUUID } from 'crypto'
import { tmpdir } from 'os'
import { join } from 'path'
diff --git a/tests/engine/color/okhcl/ui-logic.test.ts b/tests/engine/color/okhcl/ui-logic.test.ts
index 11f3748b0..1dd26878e 100644
--- a/tests/engine/color/okhcl/ui-logic.test.ts
+++ b/tests/engine/color/okhcl/ui-logic.test.ts
@@ -10,7 +10,7 @@ import {
setNodeStrokeOkHCL
} from '@open-pencil/core'
-import { expectDefined, getNodeOrThrow } from '#tests/helpers/assert'
+import { getNodeOrThrow } from '#tests/helpers/assert'
describe('OkHCL metadata toggling', () => {
test('can disable fill OkHCL metadata', () => {
diff --git a/tests/engine/color/solid-commit.test.ts b/tests/engine/color/solid-commit.test.ts
index 5b527756a..aaf4f129f 100644
--- a/tests/engine/color/solid-commit.test.ts
+++ b/tests/engine/color/solid-commit.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, test } from 'bun:test'
-import type { Fill, Stroke } from '@open-pencil/core'
+import type { Fill } from '@open-pencil/core'
import { applySolidFillColor, applySolidStrokeColor } from '@open-pencil/vue'
describe('solid color commit helpers', () => {
@@ -18,14 +18,6 @@ describe('solid color commit helpers', () => {
})
test('syncs stroke opacity with color alpha', () => {
- const stroke: Stroke = {
- color: { r: 0, g: 0, b: 1, a: 1 },
- weight: 1,
- opacity: 1,
- visible: true,
- align: 'CENTER'
- }
-
const updated = applySolidStrokeColor({ r: 1, g: 1, b: 0, a: 0.2 })
expect(updated.color?.a).toBeCloseTo(0.2, 5)
expect(updated.opacity).toBeCloseTo(0.2, 5)
diff --git a/tests/engine/editor/selection/alignment.test.ts b/tests/engine/editor/selection/alignment.test.ts
index 7511ce604..214d42813 100644
--- a/tests/engine/editor/selection/alignment.test.ts
+++ b/tests/engine/editor/selection/alignment.test.ts
@@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { SceneGraph } from '@open-pencil/core'
-import { expectDefined, getNodeOrThrow } from '#tests/helpers/assert'
+import { getNodeOrThrow } from '#tests/helpers/assert'
import { createRect, firstPageId } from '#tests/helpers/scene'
describe('single-node alignment to parent', () => {
@@ -26,7 +26,7 @@ describe('single-node alignment to parent', () => {
}
test('align left within parent', () => {
- const { graph, frame, child } = setup()
+ const { graph, child } = setup()
graph.updateNode(child.id, { x: 0 })
expect(getNodeOrThrow(graph, child.id).x).toBe(0)
})
@@ -80,7 +80,7 @@ describe('multi-node alignment', () => {
const { graph, a, b, c } = setup()
const nodes = [a, b, c].map((n) => getNodeOrThrow(graph, n.id))
const abs = nodes.map((n) => graph.getAbsolutePosition(n.id))
- const minX = Math.min(...abs.map((p, i) => p.x))
+ const minX = Math.min(...abs.map((p) => p.x))
for (const n of nodes) {
const nodeAbs = graph.getAbsolutePosition(n.id)
diff --git a/tests/engine/editor/selection/properties.test.ts b/tests/engine/editor/selection/properties.test.ts
index ee46939b9..679af4f48 100644
--- a/tests/engine/editor/selection/properties.test.ts
+++ b/tests/engine/editor/selection/properties.test.ts
@@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { SceneGraph } from '@open-pencil/core'
-import { expectDefined, getNodeOrThrow } from '#tests/helpers/assert'
+import { getNodeOrThrow } from '#tests/helpers/assert'
import { createRect, firstPageId } from '#tests/helpers/scene'
describe('multi-node property merging', () => {
diff --git a/tests/engine/fig/export/text.test.ts b/tests/engine/fig/export/text.test.ts
index 0c860258b..0115c2e44 100644
--- a/tests/engine/fig/export/text.test.ts
+++ b/tests/engine/fig/export/text.test.ts
@@ -1,34 +1,9 @@
-import { beforeAll, describe, expect, setDefaultTimeout, test } from 'bun:test'
-
-import {
- parseFigFile,
- computeAllLayouts,
- exportFigFile,
- importNodeChanges,
- initCodec,
- SceneGraph,
- FigmaAPI,
- type SceneNode,
- type Fill
-} from '@open-pencil/core'
-
-import { computeContentBounds } from '#core/io/formats/raster/render'
+import { describe, expect, setDefaultTimeout, test } from 'bun:test'
+
+import { exportFigFile, initCodec, parseFigFile, SceneGraph } from '@open-pencil/core'
import { expectDefined } from '#tests/helpers/assert'
-import {
- FIXTURES,
- parseFixture,
- parseGoldPreviewFixture,
- VALID_NODE_TYPES
-} from '#tests/helpers/fig-fixtures'
-import {
- childMatching,
- childNamed,
- collectAllNodes,
- countByType,
- previewChild
-} from '#tests/helpers/fig-traversal'
-import { heavy } from '#tests/helpers/test-utils'
+import { parseFixture } from '#tests/helpers/fig-fixtures'
setDefaultTimeout(60_000)
diff --git a/tests/engine/fig/heavy/fixtures.test.ts b/tests/engine/fig/heavy/fixtures.test.ts
index c2cc50e11..322ba9637 100644
--- a/tests/engine/fig/heavy/fixtures.test.ts
+++ b/tests/engine/fig/heavy/fixtures.test.ts
@@ -1,32 +1,9 @@
-import { beforeAll, describe, expect, setDefaultTimeout, test } from 'bun:test'
+import { beforeAll, expect, setDefaultTimeout, test } from 'bun:test'
-import {
- parseFigFile,
- computeAllLayouts,
- exportFigFile,
- importNodeChanges,
- initCodec,
- SceneGraph,
- FigmaAPI,
- type SceneNode,
- type Fill
-} from '@open-pencil/core'
+import { SceneGraph, type SceneNode } from '@open-pencil/core'
-import { computeContentBounds } from '#core/io/formats/raster/render'
-
-import { expectDefined } from '#tests/helpers/assert'
-import {
- parseFixture,
- parseGoldPreviewFixture,
- VALID_NODE_TYPES
-} from '#tests/helpers/fig-fixtures'
-import {
- childMatching,
- childNamed,
- collectAllNodes,
- countByType,
- previewChild
-} from '#tests/helpers/fig-traversal'
+import { parseFixture, VALID_NODE_TYPES } from '#tests/helpers/fig-fixtures'
+import { collectAllNodes } from '#tests/helpers/fig-traversal'
import { heavy } from '#tests/helpers/test-utils'
setDefaultTimeout(60_000)
diff --git a/tests/engine/fig/import/basic.test.ts b/tests/engine/fig/import/basic.test.ts
index 62233d0df..39603ba5d 100644
--- a/tests/engine/fig/import/basic.test.ts
+++ b/tests/engine/fig/import/basic.test.ts
@@ -1,34 +1,8 @@
import { beforeAll, describe, expect, setDefaultTimeout, test } from 'bun:test'
-import {
- parseFigFile,
- computeAllLayouts,
- exportFigFile,
- importNodeChanges,
- initCodec,
- SceneGraph,
- FigmaAPI,
- type SceneNode,
- type Fill
-} from '@open-pencil/core'
+import { SceneGraph, type SceneNode } from '@open-pencil/core'
-import { computeContentBounds } from '#core/io/formats/raster/render'
-
-import { expectDefined } from '#tests/helpers/assert'
-import {
- FIXTURES,
- parseFixture,
- parseGoldPreviewFixture,
- VALID_NODE_TYPES
-} from '#tests/helpers/fig-fixtures'
-import {
- childMatching,
- childNamed,
- collectAllNodes,
- countByType,
- previewChild
-} from '#tests/helpers/fig-traversal'
-import { heavy } from '#tests/helpers/test-utils'
+import { parseGoldPreviewFixture, VALID_NODE_TYPES } from '#tests/helpers/fig-fixtures'
setDefaultTimeout(60_000)
diff --git a/tests/engine/fig/import/edge-cases.test.ts b/tests/engine/fig/import/edge-cases.test.ts
index cabb2ffb1..afbfe0733 100644
--- a/tests/engine/fig/import/edge-cases.test.ts
+++ b/tests/engine/fig/import/edge-cases.test.ts
@@ -1,34 +1,9 @@
-import { beforeAll, describe, expect, setDefaultTimeout, test } from 'bun:test'
+import { describe, expect, setDefaultTimeout, test } from 'bun:test'
-import {
- parseFigFile,
- computeAllLayouts,
- exportFigFile,
- importNodeChanges,
- initCodec,
- SceneGraph,
- FigmaAPI,
- type SceneNode,
- type Fill
-} from '@open-pencil/core'
-
-import { computeContentBounds } from '#core/io/formats/raster/render'
+import { importNodeChanges, parseFigFile } from '@open-pencil/core'
import { expectDefined } from '#tests/helpers/assert'
-import {
- FIXTURES,
- parseFixture,
- parseGoldPreviewFixture,
- VALID_NODE_TYPES
-} from '#tests/helpers/fig-fixtures'
-import {
- childMatching,
- childNamed,
- collectAllNodes,
- countByType,
- previewChild
-} from '#tests/helpers/fig-traversal'
-import { heavy } from '#tests/helpers/test-utils'
+import { parseFixture } from '#tests/helpers/fig-fixtures'
setDefaultTimeout(60_000)
diff --git a/tests/engine/fig/import/instance-regressions.test.ts b/tests/engine/fig/import/instance-regressions.test.ts
index ed10759b7..b6b98780d 100644
--- a/tests/engine/fig/import/instance-regressions.test.ts
+++ b/tests/engine/fig/import/instance-regressions.test.ts
@@ -1,46 +1,19 @@
import { beforeAll, describe, expect, setDefaultTimeout, test } from 'bun:test'
-import {
- parseFigFile,
- computeAllLayouts,
- exportFigFile,
- importNodeChanges,
- initCodec,
- FigmaAPI,
- type SceneGraph,
- type SceneNode,
- type Fill
-} from '@open-pencil/core'
+import { computeAllLayouts, type SceneGraph, type SceneNode } from '@open-pencil/core'
import { computeContentBounds } from '#core/io/formats/raster/render'
-import { expectDefined } from '#tests/helpers/assert'
-import {
- FIXTURES,
- parseFixture,
- parseGoldPreviewFixture,
- VALID_NODE_TYPES
-} from '#tests/helpers/fig-fixtures'
+import { parseFixture } from '#tests/helpers/fig-fixtures'
import {
childMatching,
childNamed,
collectAllNodes,
- countByType,
previewChild
} from '#tests/helpers/fig-traversal'
-import { heavy } from '#tests/helpers/test-utils'
setDefaultTimeout(60_000)
-let parsed: SceneGraph
-let allNodes: SceneNode[]
-
-beforeAll(async () => {
- const fixture = await parseGoldPreviewFixture()
- parsed = fixture.graph
- allNodes = fixture.allNodes
-})
-
describe('derived instance layout regressions', () => {
let layoutGraph: SceneGraph
let layoutNodes: SceneNode[]
diff --git a/tests/engine/fig/import/property-integrity.test.ts b/tests/engine/fig/import/property-integrity.test.ts
index 3763725b5..d0068a71a 100644
--- a/tests/engine/fig/import/property-integrity.test.ts
+++ b/tests/engine/fig/import/property-integrity.test.ts
@@ -1,42 +1,15 @@
import { beforeAll, describe, expect, setDefaultTimeout, test } from 'bun:test'
-import {
- parseFigFile,
- computeAllLayouts,
- exportFigFile,
- importNodeChanges,
- initCodec,
- FigmaAPI,
- type SceneGraph,
- type SceneNode,
- type Fill
-} from '@open-pencil/core'
+import { type Fill, type SceneNode } from '@open-pencil/core'
-import { computeContentBounds } from '#core/io/formats/raster/render'
-
-import { expectDefined } from '#tests/helpers/assert'
-import {
- parseFixture,
- parseGoldPreviewFixture,
- VALID_NODE_TYPES
-} from '#tests/helpers/fig-fixtures'
-import {
- childMatching,
- childNamed,
- collectAllNodes,
- countByType,
- previewChild
-} from '#tests/helpers/fig-traversal'
-import { heavy } from '#tests/helpers/test-utils'
+import { parseGoldPreviewFixture } from '#tests/helpers/fig-fixtures'
setDefaultTimeout(60_000)
-let parsed: SceneGraph
let allNodes: SceneNode[]
beforeAll(async () => {
const fixture = await parseGoldPreviewFixture()
- parsed = fixture.graph
allNodes = fixture.allNodes
})
@@ -82,7 +55,7 @@ describe('property integrity', () => {
})
test('fills have valid colors', () => {
- function checkFill(fill: Fill, nodeName: string) {
+ function checkFill(fill: Fill) {
if (fill.type === 'SOLID') {
const { r, g, b, a } = fill.color
expect(r).toBeGreaterThanOrEqual(0)
@@ -97,7 +70,7 @@ describe('property integrity', () => {
}
for (const n of allNodes) {
for (const fill of n.fills) {
- checkFill(fill, n.name)
+ checkFill(fill)
}
}
})
diff --git a/tests/engine/fig/roundtrip/basic.test.ts b/tests/engine/fig/roundtrip/basic.test.ts
index fbce28025..356c15e97 100644
--- a/tests/engine/fig/roundtrip/basic.test.ts
+++ b/tests/engine/fig/roundtrip/basic.test.ts
@@ -1,34 +1,15 @@
import { beforeAll, describe, expect, setDefaultTimeout, test } from 'bun:test'
import {
- parseFigFile,
- computeAllLayouts,
exportFigFile,
- importNodeChanges,
initCodec,
+ parseFigFile,
SceneGraph,
- FigmaAPI,
- type SceneNode,
- type Fill
+ type SceneNode
} from '@open-pencil/core'
-import { computeContentBounds } from '#core/io/formats/raster/render'
-
import { expectDefined } from '#tests/helpers/assert'
-import {
- FIXTURES,
- parseFixture,
- parseGoldPreviewFixture,
- VALID_NODE_TYPES
-} from '#tests/helpers/fig-fixtures'
-import {
- childMatching,
- childNamed,
- collectAllNodes,
- countByType,
- previewChild
-} from '#tests/helpers/fig-traversal'
-import { heavy } from '#tests/helpers/test-utils'
+import { collectAllNodes, countByType } from '#tests/helpers/fig-traversal'
setDefaultTimeout(60_000)
diff --git a/tests/engine/fig/roundtrip/variables.test.ts b/tests/engine/fig/roundtrip/variables.test.ts
index b72e624fd..478ceea77 100644
--- a/tests/engine/fig/roundtrip/variables.test.ts
+++ b/tests/engine/fig/roundtrip/variables.test.ts
@@ -1,35 +1,16 @@
-import { beforeAll, describe, expect, setDefaultTimeout, test } from 'bun:test'
+import { describe, expect, setDefaultTimeout, test } from 'bun:test'
import {
- parseFigFile,
- computeAllLayouts,
exportFigFile,
- importNodeChanges,
+ FigmaAPI,
initCodec,
+ parseFigFile,
SceneGraph,
- FigmaAPI,
- type SceneNode,
- type Fill,
type Color
} from '@open-pencil/core'
-import { computeContentBounds } from '#core/io/formats/raster/render'
-
import { expectDefined } from '#tests/helpers/assert'
-import {
- FIXTURES,
- parseFixture,
- parseGoldPreviewFixture,
- VALID_NODE_TYPES
-} from '#tests/helpers/fig-fixtures'
-import {
- childMatching,
- childNamed,
- collectAllNodes,
- countByType,
- previewChild
-} from '#tests/helpers/fig-traversal'
-import { heavy } from '#tests/helpers/test-utils'
+import { parseFixture } from '#tests/helpers/fig-fixtures'
setDefaultTimeout(60_000)
diff --git a/tests/engine/hit-test/basic.test.ts b/tests/engine/hit-test/basic.test.ts
index 1606ac89d..b9378e810 100644
--- a/tests/engine/hit-test/basic.test.ts
+++ b/tests/engine/hit-test/basic.test.ts
@@ -139,7 +139,6 @@ describe('hitTest — opacity', () => {
describe('hitTest — point outside all nodes', () => {
test('returns null for empty area', () => {
const graph = new SceneGraph()
- const page = pageId(graph)
const hit = graph.hitTest(500, 500)
expect(hit).toBeNull()
diff --git a/tests/engine/hit-test/scope.test.ts b/tests/engine/hit-test/scope.test.ts
index f4fc0ae3b..729320586 100644
--- a/tests/engine/hit-test/scope.test.ts
+++ b/tests/engine/hit-test/scope.test.ts
@@ -1,4 +1,4 @@
-import { describe, test, expect } from 'bun:test'
+import { describe, expect, test } from 'bun:test'
import { SceneGraph } from '@open-pencil/core'
@@ -28,7 +28,7 @@ describe('hitTest — group behavior', () => {
}
test('single click on child returns GROUP (not child)', () => {
- const { graph, page, child } = setup()
+ const { graph, page } = setup()
const hit = graph.hitTest(110, 110, page)
expect(hit).not.toBeNull()
expect(hit!.type).toBe('GROUP')
diff --git a/tests/engine/kiwi/serialize-fixes.test.ts b/tests/engine/kiwi/serialize-fixes.test.ts
index 7ca59d52f..3cd6d00ce 100644
--- a/tests/engine/kiwi/serialize-fixes.test.ts
+++ b/tests/engine/kiwi/serialize-fixes.test.ts
@@ -1,11 +1,11 @@
-import { describe, test, expect, beforeAll } from 'bun:test'
+import { beforeAll, describe, expect, test } from 'bun:test'
import {
- SceneGraph,
- sceneNodeToKiwi,
exportFigFile,
+ initCodec,
parseFigFile,
- initCodec
+ SceneGraph,
+ sceneNodeToKiwi
} from '@open-pencil/core'
beforeAll(async () => {
@@ -44,7 +44,7 @@ describe('Fix 1: auto-layout child transforms', () => {
paddingRight: 16
})
- const child = graph.createNode('FRAME', parent.id, {
+ graph.createNode('FRAME', parent.id, {
name: 'Child',
x: 50,
y: 100,
@@ -82,7 +82,7 @@ describe('Fix 1: auto-layout child transforms', () => {
itemSpacing: 8
})
- const absChild = graph.createNode('FRAME', parent.id, {
+ graph.createNode('FRAME', parent.id, {
name: 'AbsChild',
x: 75,
y: 120,
@@ -118,7 +118,7 @@ describe('Fix 1: auto-layout child transforms', () => {
// layoutMode defaults to 'NONE'
})
- const child = graph.createNode('FRAME', parent.id, {
+ graph.createNode('FRAME', parent.id, {
name: 'Child',
x: 30,
y: 45,
@@ -591,7 +591,7 @@ describe('Directionality plugin fallback', () => {
width: 240,
height: 80
})
- const text = graph.createNode('TEXT', frame.id, {
+ graph.createNode('TEXT', frame.id, {
text: 'مرحبا',
textDirection: 'RTL',
width: 120,
diff --git a/tests/engine/layout/auto-layout.test.ts b/tests/engine/layout/auto-layout.test.ts
index 25db12b75..6725a2607 100644
--- a/tests/engine/layout/auto-layout.test.ts
+++ b/tests/engine/layout/auto-layout.test.ts
@@ -1,10 +1,9 @@
import { describe, expect, test } from 'bun:test'
import {
- computeLayout,
computeAllLayouts,
+ computeLayout,
createEditor,
- FigmaAPI,
SceneGraph,
setTextMeasurer
} from '@open-pencil/core'
diff --git a/tests/engine/mcp.test.ts b/tests/engine/mcp.test.ts
index 5903a8ce0..e5b847270 100644
--- a/tests/engine/mcp.test.ts
+++ b/tests/engine/mcp.test.ts
@@ -120,7 +120,7 @@ describe('MCP tool execution', () => {
name: 'Parent'
}) as { id: string }
- const child = findTool('create_shape').execute(api, {
+ findTool('create_shape').execute(api, {
type: 'TEXT',
x: 0,
y: 0,
@@ -128,7 +128,7 @@ describe('MCP tool execution', () => {
height: 30,
name: 'Child',
parent_id: parent.id
- }) as { id: string }
+ })
const tree = findTool('get_page_tree').execute(api, {}) as {
children: { id: string; children?: unknown[] }[]
diff --git a/tests/engine/mcp/stdio.test.ts b/tests/engine/mcp/stdio.test.ts
index 59b231dfe..48175a725 100644
--- a/tests/engine/mcp/stdio.test.ts
+++ b/tests/engine/mcp/stdio.test.ts
@@ -1,4 +1,4 @@
-import { describe, expect, test, beforeEach, afterEach } from 'bun:test'
+import { afterEach, beforeEach, describe, expect, test } from 'bun:test'
import type { AddressInfo } from 'node:net'
import type { Client } from '@modelcontextprotocol/sdk/client/index.js'
@@ -161,7 +161,6 @@ describe('MCP stdio transport', () => {
expect(data.type).toBe('FRAME')
expect(data.name).toBe('StdioFrame')
- const node = app.graph.getNode(data.id)
expect(getNodeOrThrow(app.graph, data.id).width).toBe(200)
})
diff --git a/tests/engine/render/canvas/silhouette-autopsy.test.ts b/tests/engine/render/canvas/silhouette-autopsy.test.ts
index ee7ae9f64..e753956fe 100644
--- a/tests/engine/render/canvas/silhouette-autopsy.test.ts
+++ b/tests/engine/render/canvas/silhouette-autopsy.test.ts
@@ -19,12 +19,7 @@ import { SkiaRenderer } from '#core/canvas'
import { SceneGraph } from '#core/scene-graph'
import { fontManager } from '#core/text'
-import {
- cliSourcePath,
- coreSourcePath,
- publicPath,
- testPath as repoTestPath
-} from '#tests/helpers/paths'
+import { coreSourcePath, publicPath, testPath as repoTestPath } from '#tests/helpers/paths'
// === CLAIM EXTRACTION ===
// Each claim is: [doc_section, claim_text, verification_strategy]
@@ -499,7 +494,7 @@ describe('Doc 01/03 — Runtime Behavior Verification', () => {
]
})
- const child = graph.createNode('RECTANGLE', parentWithFill.id, {
+ graph.createNode('RECTANGLE', parentWithFill.id, {
x: 25,
y: 25,
width: 50,
diff --git a/tests/engine/scene-graph/basic.test.ts b/tests/engine/scene-graph/basic.test.ts
index 5fecad907..ecc15404f 100644
--- a/tests/engine/scene-graph/basic.test.ts
+++ b/tests/engine/scene-graph/basic.test.ts
@@ -1,4 +1,4 @@
-import { describe, test, expect } from 'bun:test'
+import { describe, expect, test } from 'bun:test'
import { SceneGraph } from '@open-pencil/core'
@@ -801,7 +801,7 @@ describe('hitTest', () => {
test('hidden node is not hittable', () => {
const graph = new SceneGraph()
const page = pageId(graph)
- const rectId = graph.createNode('RECTANGLE', page, {
+ graph.createNode('RECTANGLE', page, {
name: 'Hidden',
x: 0,
y: 0,
@@ -809,7 +809,7 @@ describe('hitTest', () => {
height: 100,
fills: [{ type: 'SOLID', color: { r: 1, g: 0, b: 0, a: 1 }, opacity: 1, visible: true }],
visible: false
- }).id
+ })
// Hidden nodes should be skipped during hit testing
expect(graph.hitTest(50, 50, page)).toBeNull()
})
@@ -851,7 +851,6 @@ describe('hitTest', () => {
describe('updateNode', () => {
test('non-layout change does not clear absPosCache', () => {
const graph = new SceneGraph()
- const page = pageId(graph)
const rId = rect(graph, 'R', 100, 200)
// Populate absPosCache by calling getAbsolutePosition
const absPos = graph.getAbsolutePosition(rId)
@@ -865,7 +864,6 @@ describe('updateNode', () => {
test('layout change clears absPosCache', () => {
const graph = new SceneGraph()
- const page = pageId(graph)
const rId = rect(graph, 'R', 100, 200)
const absPos = graph.getAbsolutePosition(rId)
expect(absPos).toEqual({ x: 100, y: 200 })
@@ -1107,7 +1105,6 @@ describe('countDescendants', () => {
test('root node count includes all pages and their children', () => {
const graph = new SceneGraph()
- const page = pageId(graph)
rect(graph, 'R1')
rect(graph, 'R2')
graph.addPage('Page 2')
diff --git a/tests/engine/scene-graph/world-transform.test.ts b/tests/engine/scene-graph/world-transform.test.ts
index be0c71b8e..2c3d1ec07 100644
--- a/tests/engine/scene-graph/world-transform.test.ts
+++ b/tests/engine/scene-graph/world-transform.test.ts
@@ -5,10 +5,9 @@
* correct world coordinates for rotated, flipped, and nested nodes.
* The tests exercise the full transform chain through the SceneGraph API.
*/
-import { describe, test, expect } from 'bun:test'
+import { describe, expect, test } from 'bun:test'
-import { SceneGraph, getWorldMatrix, TransformMatrix } from '@open-pencil/core'
-import type { SceneNode } from '@open-pencil/core'
+import { getWorldMatrix, SceneGraph, TransformMatrix } from '@open-pencil/core'
function pageId(graph: SceneGraph) {
return graph.getPages()[0].id
diff --git a/tests/engine/svg/export.test.ts b/tests/engine/svg/export.test.ts
index daefb02eb..bdb7707df 100644
--- a/tests/engine/svg/export.test.ts
+++ b/tests/engine/svg/export.test.ts
@@ -2,11 +2,11 @@ import { describe, expect, test } from 'bun:test'
import {
SceneGraph,
- renderNodesToSVG,
geometryBlobToSVGPath,
- vectorNetworkToSVGPaths,
+ renderNodesToSVG,
+ renderSVGNode,
svg,
- renderSVGNode
+ vectorNetworkToSVGPaths
} from '@open-pencil/core'
function makeGraph() {
@@ -69,16 +69,6 @@ describe('svg() and renderSVGNode()', () => {
// --- geometryBlobToSVGPath tests ---
describe('geometryBlobToSVGPath()', () => {
- function makeBlob(commands: number[]): Uint8Array {
- const buf = new ArrayBuffer(commands.length)
- const view = new DataView(buf)
- let o = 0
- for (const cmd of commands) {
- view.setUint8(o++, cmd)
- }
- return new Uint8Array(buf)
- }
-
function makeBlobWithFloats(ops: Array<{ cmd: number; floats?: number[] }>): Uint8Array {
let size = 0
for (const op of ops) {
diff --git a/tests/engine/text/style-runs.test.ts b/tests/engine/text/style-runs.test.ts
index db17c5a73..71df0c85f 100644
--- a/tests/engine/text/style-runs.test.ts
+++ b/tests/engine/text/style-runs.test.ts
@@ -1,15 +1,15 @@
-import { describe, test, expect } from 'bun:test'
+import { describe, expect, test } from 'bun:test'
import {
- getStyleAt,
+ adjustRunsForDelete,
+ adjustRunsForInsert,
applyStyleToRange,
+ getStyleAt,
removeStyleFromRange,
selectionHasStyle,
- adjustRunsForInsert,
- adjustRunsForDelete,
toggleBoldInRange,
- toggleItalicInRange,
toggleDecorationInRange,
+ toggleItalicInRange,
type StyleRun
} from '@open-pencil/core'
@@ -124,7 +124,7 @@ describe('toggleBoldInRange', () => {
test('bold to non-bold', () => {
const existing: StyleRun[] = [{ start: 0, length: 5, style: { fontWeight: 700 } }]
- const { runs, newWeight } = toggleBoldInRange(existing, 0, 5, 400, 10)
+ const { newWeight } = toggleBoldInRange(existing, 0, 5, 400, 10)
expect(newWeight).toBe(400)
})
})
diff --git a/tests/engine/tools/ai-adapter.test.ts b/tests/engine/tools/ai-adapter.test.ts
index 1cd5d2e18..d81fe7a5e 100644
--- a/tests/engine/tools/ai-adapter.test.ts
+++ b/tests/engine/tools/ai-adapter.test.ts
@@ -39,7 +39,7 @@ describe('AI adapter', () => {
test('each tool has description and execute', () => {
const { tools } = setup()
- for (const [name, t] of Object.entries(tools)) {
+ for (const t of Object.values(tools)) {
const aiTool = t as AdapterTool
expect(aiTool.description).toBeTruthy()
expect(typeof aiTool.execute).toBe('function')
diff --git a/tests/engine/tools/cli.test.ts b/tests/engine/tools/cli.test.ts
index b1d6fc841..cb9c96295 100644
--- a/tests/engine/tools/cli.test.ts
+++ b/tests/engine/tools/cli.test.ts
@@ -1,5 +1,4 @@
-import { describe, expect, test, setDefaultTimeout } from 'bun:test'
-import { join } from 'path'
+import { expect, setDefaultTimeout, test } from 'bun:test'
import { cliSourcePath, repoPath } from '#tests/helpers/paths'
import { heavy } from '#tests/helpers/test-utils'
diff --git a/tests/engine/tools/modify.test.ts b/tests/engine/tools/modify.test.ts
index 2112f964e..46104e86f 100644
--- a/tests/engine/tools/modify.test.ts
+++ b/tests/engine/tools/modify.test.ts
@@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'
import { computeAllLayouts } from '@open-pencil/core'
-import { ALL_TOOLS, getTool, setupToolTest, type ToolResult } from '#tests/helpers/tools'
+import { getTool, setupToolTest, type ToolResult } from '#tests/helpers/tools'
describe('set_fill', () => {
test('sets solid fill', () => {
diff --git a/tests/engine/tools/registry.test.ts b/tests/engine/tools/registry.test.ts
index ba8a9bf61..3dde31fb6 100644
--- a/tests/engine/tools/registry.test.ts
+++ b/tests/engine/tools/registry.test.ts
@@ -19,7 +19,7 @@ describe('tool definitions', () => {
test('required params are marked', () => {
for (const t of ALL_TOOLS) {
- for (const [key, param] of Object.entries(t.params)) {
+ for (const param of Object.values(t.params)) {
expect(typeof param.type).toBe('string')
expect(typeof param.description).toBe('string')
}
diff --git a/tests/engine/visual-inner-shadow-counter.ts b/tests/engine/visual-inner-shadow-counter.ts
index ff8047c9d..5d2c94d0d 100644
--- a/tests/engine/visual-inner-shadow-counter.ts
+++ b/tests/engine/visual-inner-shadow-counter.ts
@@ -3,8 +3,8 @@ import { join } from 'node:path'
import { initCanvasKit } from '#cli/headless'
import { SkiaRenderer } from '#core/canvas'
-import { SceneGraph } from '#core/scene-graph'
import type { SceneNode } from '#core/scene-graph'
+import { SceneGraph } from '#core/scene-graph'
import { fontManager } from '#core/text'
async function main() {
@@ -53,8 +53,7 @@ async function main() {
]
} satisfies Partial<SceneNode>
- const textNode = graph.createNode('TEXT', pageId, textProps)
- const nodeId = textNode.id
+ graph.createNode('TEXT', pageId, textProps)
const surface = ck.MakeSurface(width, height)!
const canvas = surface.getCanvas()