@operato/scene-storage 10.0.0-beta.30 → 10.0.0-beta.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ *
4
+ * Phase H — Pallet / Box 의 Pickable 구현 단위테스트.
5
+ *
6
+ * source-level + helper integration:
7
+ * - Pallet: rectangularFootprintFrames 로 4-way fork entry
8
+ * - Box: topApproachFrame 로 단일 gripper entry
9
+ * - 호환성 시나리오: forklift 가 pallet 만 picks, gripper 가 box 만 picks
10
+ */
11
+
12
+ import 'should'
13
+ import * as fs from 'fs'
14
+ import { fileURLToPath } from 'url'
15
+
16
+ function readSrc(relPath: string): string {
17
+ const url = new URL(relPath, import.meta.url)
18
+ return fs.readFileSync(fileURLToPath(url), 'utf-8')
19
+ }
20
+
21
+ describe('Phase H — Pallet pickupFrames', () => {
22
+ it('rectangularFootprintFrames helper 사용', () => {
23
+ const src = readSrc('../src/pallet.ts')
24
+ src.should.match(/import\s*\{[^}]*rectangularFootprintFrames/)
25
+ src.should.match(/pickupFrames\(\):\s*PickupFrame\[\]/)
26
+ src.should.match(/rectangularFootprintFrames\(\{/)
27
+ })
28
+
29
+ it('forklift-fork toolType', () => {
30
+ const src = readSrc('../src/pallet.ts')
31
+ src.should.match(/toolType:\s*['"]forklift-fork['"]/)
32
+ })
33
+
34
+ it('4-way 진입 (모든 면)', () => {
35
+ const src = readSrc('../src/pallet.ts')
36
+ src.should.match(/sides:\s*\[\s*['"]east['"],\s*['"]west['"],\s*['"]north['"],\s*['"]south['"]\s*\]/)
37
+ })
38
+
39
+ it('fork pocket 위치 (palletDepth * 0.4)', () => {
40
+ const src = readSrc('../src/pallet.ts')
41
+ src.should.match(/entryHeight:\s*palletDepth\s*\*\s*0\.4/)
42
+ })
43
+
44
+ it('tolerance 명시 (50mm / 5°)', () => {
45
+ const src = readSrc('../src/pallet.ts')
46
+ src.should.match(/positionMm:\s*50/)
47
+ src.should.match(/angleDeg:\s*5/)
48
+ })
49
+ })
50
+
51
+ describe('Phase H — Box pickupFrames', () => {
52
+ it('topApproachFrame helper 사용', () => {
53
+ const src = readSrc('../src/box.ts')
54
+ src.should.match(/import\s*\{[^}]*topApproachFrame/)
55
+ src.should.match(/pickupFrames\(\):\s*PickupFrame\[\]/)
56
+ src.should.match(/topApproachFrame\(\{/)
57
+ })
58
+
59
+ it('gripper toolType (vacuum / 2-finger / 3-finger 모두 매칭)', () => {
60
+ const src = readSrc('../src/box.ts')
61
+ src.should.match(/toolType:\s*['"]gripper['"]/)
62
+ })
63
+
64
+ it('단일 entry (top-gripper)', () => {
65
+ const src = readSrc('../src/box.ts')
66
+ src.should.match(/id:\s*['"]top-gripper['"]/)
67
+ })
68
+
69
+ it('정밀한 tolerance (5mm / 1°) — gripper 정밀도 반영', () => {
70
+ const src = readSrc('../src/box.ts')
71
+ src.should.match(/positionMm:\s*5/)
72
+ src.should.match(/angleDeg:\s*1/)
73
+ })
74
+ })
75
+
76
+ describe('Phase H — Parcel pickupFrames', () => {
77
+ it('topApproachFrame helper 사용 (Box 와 동일 패턴)', () => {
78
+ const src = readSrc('../src/parcel.ts')
79
+ src.should.match(/import\s*\{[^}]*topApproachFrame/)
80
+ src.should.match(/topApproachFrame\(\{/)
81
+ })
82
+
83
+ it('gripper toolType + suction id', () => {
84
+ const src = readSrc('../src/parcel.ts')
85
+ src.should.match(/toolType:\s*['"]gripper['"]/)
86
+ src.should.match(/id:\s*['"]top-suction['"]/)
87
+ })
88
+
89
+ it('완화된 tolerance (10mm / 2°) — cardboard 변형 감안', () => {
90
+ const src = readSrc('../src/parcel.ts')
91
+ src.should.match(/positionMm:\s*10/)
92
+ src.should.match(/angleDeg:\s*2/)
93
+ })
94
+ })
95
+
96
+ describe('Phase H invariant — carrier 별 toolType 분리', () => {
97
+ it('Pallet 은 forklift-fork 만, Box 는 gripper 만 — 자동 호환성 검사 통과', () => {
98
+ const palletSrc = readSrc('../src/pallet.ts')
99
+ const boxSrc = readSrc('../src/box.ts')
100
+ palletSrc.should.match(/forklift-fork/)
101
+ palletSrc.should.not.match(/toolType:\s*['"]gripper['"]/)
102
+ boxSrc.should.match(/gripper/)
103
+ boxSrc.should.not.match(/forklift-fork/)
104
+ })
105
+ })