test(nodes): isolate cabinet regression suites (#517)
This commit is contained in:
@@ -2319,9 +2319,17 @@ describe('cabinet handles', () => {
|
|||||||
sceneApi: ReturnType<typeof sceneApiFixture>,
|
sceneApi: ReturnType<typeof sceneApiFixture>,
|
||||||
) => HandleDescriptor<CabinetNode>[]
|
) => HandleDescriptor<CabinetNode>[]
|
||||||
const depthHandles = buildHandles(source, fixture.sceneApi).filter(
|
const depthHandles = buildHandles(source, fixture.sceneApi).filter(
|
||||||
(handle): handle is LinearResizeHandle<CabinetNode> =>
|
(handle): handle is LinearResizeHandle<CabinetNode> => {
|
||||||
handle.kind === 'linear-resize' &&
|
if (
|
||||||
handle.visible?.(source, fixture.sceneApi as never) !== false,
|
handle.kind !== 'linear-resize' ||
|
||||||
|
handle.visible?.(source, fixture.sceneApi as never) === false
|
||||||
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const targetId = handle.overrideTarget?.(source, fixture.sceneApi as never) ?? source.id
|
||||||
|
const target = fixture.sceneApi.get(targetId)
|
||||||
|
return target?.type === 'cabinet' && target.runTier === 'base'
|
||||||
|
},
|
||||||
)
|
)
|
||||||
return { ...fixture, depthHandles, source, thirdRun }
|
return { ...fixture, depthHandles, source, thirdRun }
|
||||||
}
|
}
|
||||||
@@ -2613,6 +2621,7 @@ describe('cabinet handles', () => {
|
|||||||
[run, ...modules].map((node) => [node.id as AnyNodeId, node as AnyNode]),
|
[run, ...modules].map((node) => [node.id as AnyNodeId, node as AnyNode]),
|
||||||
) as Record<AnyNodeId, AnyNode>
|
) as Record<AnyNodeId, AnyNode>
|
||||||
const sceneApi = {
|
const sceneApi = {
|
||||||
|
get: (id: AnyNodeId) => nodes[id],
|
||||||
nodes: () => nodes,
|
nodes: () => nodes,
|
||||||
}
|
}
|
||||||
const rotateHandle = (
|
const rotateHandle = (
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { describe, expect, mock, test } from 'bun:test'
|
import { describe, expect, test } from 'bun:test'
|
||||||
import type {
|
import type {
|
||||||
AnyNode,
|
AnyNode,
|
||||||
AnyNodeId,
|
AnyNodeId,
|
||||||
@@ -8,19 +8,10 @@ import type {
|
|||||||
LinearResizeHandle,
|
LinearResizeHandle,
|
||||||
SceneApi,
|
SceneApi,
|
||||||
} from '@pascal-app/core'
|
} from '@pascal-app/core'
|
||||||
|
import { cabinetDefinition, cabinetModuleDefinition } from '../definition'
|
||||||
import { addCornerRun } from '../run-ops'
|
import { addCornerRun } from '../run-ops'
|
||||||
import { CabinetModuleNode, CabinetNode } from '../schema'
|
import { CabinetModuleNode, CabinetNode } from '../schema'
|
||||||
|
|
||||||
mock.module('../floorplan-move', () => ({ cabinetModuleFloorplanMoveTarget: () => null }))
|
|
||||||
mock.module('../floorplan', () => ({
|
|
||||||
buildCabinetFloorplan: () => null,
|
|
||||||
buildCabinetModuleFloorplan: () => null,
|
|
||||||
}))
|
|
||||||
mock.module('../geometry', () => ({ buildCabinetGeometry: () => null }))
|
|
||||||
mock.module('../paint', () => ({ cabinetPaint: {} }))
|
|
||||||
|
|
||||||
const { cabinetDefinition, cabinetModuleDefinition } = await import('../definition')
|
|
||||||
|
|
||||||
function wallDepthFixture() {
|
function wallDepthFixture() {
|
||||||
const root = {
|
const root = {
|
||||||
...CabinetNode.parse({
|
...CabinetNode.parse({
|
||||||
|
|||||||
@@ -1,14 +1,7 @@
|
|||||||
import { describe, expect, mock, test } from 'bun:test'
|
import { describe, expect, test } from 'bun:test'
|
||||||
import type { WallNode, WallTrimConfig } from '@pascal-app/core'
|
import type { WallNode, WallTrimConfig } from '@pascal-app/core'
|
||||||
import { buildWallTreatmentLevelData } from './treatment-level-data'
|
import { buildWallTreatmentLevelData } from './treatment-level-data'
|
||||||
|
import { buildTrimGeometry, wallTreatmentProudOffsets } from './treatments'
|
||||||
mock.module('@pascal-app/viewer', () => ({
|
|
||||||
baseMaterial: () => undefined,
|
|
||||||
createMaterialFromPresetRef: () => undefined,
|
|
||||||
resolveMaterialRef: () => undefined,
|
|
||||||
}))
|
|
||||||
|
|
||||||
const { buildTrimGeometry, wallTreatmentProudOffsets } = await import('./treatments')
|
|
||||||
|
|
||||||
function wall(id: string, start: [number, number], end: [number, number]): WallNode {
|
function wall(id: string, start: [number, number], end: [number, number]): WallNode {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user