sunpeak 0.8.6 → 0.8.8

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.
Files changed (34) hide show
  1. package/bin/commands/build.mjs +3 -3
  2. package/bin/commands/pull.mjs +2 -2
  3. package/bin/sunpeak.js +4 -6
  4. package/dist/mcp/entry.cjs.map +1 -1
  5. package/dist/mcp/entry.js.map +1 -1
  6. package/dist/style.css +0 -37
  7. package/package.json +1 -1
  8. package/template/.sunpeak/dev.tsx +2 -2
  9. package/template/README.md +5 -5
  10. package/template/dist/albums.js +1 -1
  11. package/template/dist/albums.json +1 -1
  12. package/template/dist/carousel.js +1 -1
  13. package/template/dist/carousel.json +1 -1
  14. package/template/dist/map.js +1 -1
  15. package/template/dist/map.json +1 -1
  16. package/template/dist/review.js +1 -1
  17. package/template/dist/review.json +1 -1
  18. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Button.js +3 -3
  19. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_SegmentedControl.js +4 -4
  20. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Select.js +20 -20
  21. package/template/node_modules/.vite/deps/@openai_apps-sdk-ui_components_Textarea.js +3 -3
  22. package/template/node_modules/.vite/deps/_metadata.json +35 -35
  23. package/template/node_modules/.vite/deps/{chunk-SPYXUHEY.js → chunk-N6DVYEXK.js} +8 -8
  24. package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
  25. package/template/src/resources/index.ts +4 -4
  26. package/template/src/resources/map-resource.test.tsx +95 -0
  27. package/template/src/resources/review-resource.test.tsx +538 -0
  28. package/template/dist/counter.js +0 -49
  29. package/template/dist/counter.json +0 -15
  30. package/template/src/resources/counter-resource.json +0 -12
  31. package/template/src/resources/counter-resource.test.tsx +0 -116
  32. package/template/src/resources/counter-resource.tsx +0 -101
  33. package/template/src/simulations/counter-show-simulation.json +0 -20
  34. /package/template/node_modules/.vite/deps/{chunk-SPYXUHEY.js.map → chunk-N6DVYEXK.js.map} +0 -0
@@ -12,5 +12,5 @@
12
12
  ]
13
13
  }
14
14
  },
15
- "uri": "ui://review-mjt2f5f3"
15
+ "uri": "ui://review-mjw4w0g9"
16
16
  }
@@ -2,13 +2,13 @@ import {
2
2
  Button,
3
3
  ButtonLink,
4
4
  CopyButton
5
- } from "./chunk-SPYXUHEY.js";
6
- import "./chunk-UM3ZGDFR.js";
5
+ } from "./chunk-N6DVYEXK.js";
7
6
  import "./chunk-JAGHY6H6.js";
8
- import "./chunk-DYQDWJMS.js";
9
7
  import "./chunk-QPJAV452.js";
8
+ import "./chunk-DYQDWJMS.js";
10
9
  import "./chunk-EGRHWZRV.js";
11
10
  import "./chunk-CNYJBM5F.js";
11
+ import "./chunk-UM3ZGDFR.js";
12
12
  import "./chunk-JGVISENQ.js";
13
13
  import "./chunk-BUOVMFCD.js";
14
14
  import "./chunk-ILHRZGIS.js";
@@ -1,7 +1,3 @@
1
- import {
2
- dist_exports4 as dist_exports
3
- } from "./chunk-TSEQUROC.js";
4
- import "./chunk-XZTIOEPG.js";
5
1
  import {
6
2
  useResizeObserver
7
3
  } from "./chunk-JAGHY6H6.js";
@@ -10,6 +6,10 @@ import {
10
6
  waitForAnimationFrame
11
7
  } from "./chunk-DYQDWJMS.js";
12
8
  import "./chunk-EGRHWZRV.js";
9
+ import {
10
+ dist_exports4 as dist_exports
11
+ } from "./chunk-TSEQUROC.js";
12
+ import "./chunk-XZTIOEPG.js";
13
13
  import {
14
14
  clsx_default
15
15
  } from "./chunk-CNYJBM5F.js";
@@ -1,41 +1,41 @@
1
1
  import {
2
- dist_exports,
3
- dist_exports3 as dist_exports2,
4
- dist_exports5 as dist_exports3
5
- } from "./chunk-TSEQUROC.js";
6
- import "./chunk-XZTIOEPG.js";
2
+ Input
3
+ } from "./chunk-2DZGWGIP.js";
7
4
  import {
8
5
  Button,
9
6
  LoadingIndicator,
10
7
  TransitionGroup
11
- } from "./chunk-SPYXUHEY.js";
12
- import {
13
- Check_default,
14
- ChevronDownVector_default,
15
- DropdownVector_default,
16
- Info_default,
17
- Search_default,
18
- X_default
19
- } from "./chunk-UM3ZGDFR.js";
8
+ } from "./chunk-N6DVYEXK.js";
20
9
  import {
21
10
  useTimeout
22
11
  } from "./chunk-JAGHY6H6.js";
12
+ import {
13
+ o
14
+ } from "./chunk-QPJAV452.js";
23
15
  import {
24
16
  handlePressableMouseEnter,
25
17
  preventDefaultHandler,
26
18
  toCssVariables,
27
19
  waitForAnimationFrame
28
20
  } from "./chunk-DYQDWJMS.js";
29
- import {
30
- Input
31
- } from "./chunk-2DZGWGIP.js";
32
- import {
33
- o
34
- } from "./chunk-QPJAV452.js";
35
21
  import "./chunk-EGRHWZRV.js";
22
+ import {
23
+ dist_exports,
24
+ dist_exports3 as dist_exports2,
25
+ dist_exports5 as dist_exports3
26
+ } from "./chunk-TSEQUROC.js";
27
+ import "./chunk-XZTIOEPG.js";
36
28
  import {
37
29
  clsx_default
38
30
  } from "./chunk-CNYJBM5F.js";
31
+ import {
32
+ Check_default,
33
+ ChevronDownVector_default,
34
+ DropdownVector_default,
35
+ Info_default,
36
+ Search_default,
37
+ X_default
38
+ } from "./chunk-UM3ZGDFR.js";
39
39
  import {
40
40
  require_jsx_runtime
41
41
  } from "./chunk-JGVISENQ.js";
@@ -1,9 +1,9 @@
1
- import {
2
- toCssVariables
3
- } from "./chunk-DYQDWJMS.js";
4
1
  import {
5
2
  o
6
3
  } from "./chunk-QPJAV452.js";
4
+ import {
5
+ toCssVariables
6
+ } from "./chunk-DYQDWJMS.js";
7
7
  import "./chunk-EGRHWZRV.js";
8
8
  import {
9
9
  clsx_default
@@ -7,149 +7,149 @@
7
7
  "react": {
8
8
  "src": "../../../../node_modules/.pnpm/react@19.2.3/node_modules/react/index.js",
9
9
  "file": "react.js",
10
- "fileHash": "c4294f84",
10
+ "fileHash": "d6aa24ec",
11
11
  "needsInterop": true
12
12
  },
13
13
  "react-dom": {
14
14
  "src": "../../../../node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/index.js",
15
15
  "file": "react-dom.js",
16
- "fileHash": "146a1adb",
16
+ "fileHash": "a84166b8",
17
17
  "needsInterop": true
18
18
  },
19
19
  "react/jsx-dev-runtime": {
20
20
  "src": "../../../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-dev-runtime.js",
21
21
  "file": "react_jsx-dev-runtime.js",
22
- "fileHash": "fcc76c2e",
22
+ "fileHash": "92c4ccf8",
23
23
  "needsInterop": true
24
24
  },
25
25
  "react/jsx-runtime": {
26
26
  "src": "../../../../node_modules/.pnpm/react@19.2.3/node_modules/react/jsx-runtime.js",
27
27
  "file": "react_jsx-runtime.js",
28
- "fileHash": "dff7cd13",
28
+ "fileHash": "fee8e947",
29
29
  "needsInterop": true
30
30
  },
31
31
  "@openai/apps-sdk-ui/components/Avatar": {
32
32
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.1_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._90324f97b7190ccfdbe40a9e8bef3385/node_modules/@openai/apps-sdk-ui/dist/es/components/Avatar/index.js",
33
33
  "file": "@openai_apps-sdk-ui_components_Avatar.js",
34
- "fileHash": "90549264",
34
+ "fileHash": "d1d0268f",
35
35
  "needsInterop": false
36
36
  },
37
37
  "@openai/apps-sdk-ui/components/Button": {
38
38
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.1_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._90324f97b7190ccfdbe40a9e8bef3385/node_modules/@openai/apps-sdk-ui/dist/es/components/Button/index.js",
39
39
  "file": "@openai_apps-sdk-ui_components_Button.js",
40
- "fileHash": "1682d230",
40
+ "fileHash": "0d815226",
41
41
  "needsInterop": false
42
42
  },
43
43
  "@openai/apps-sdk-ui/components/Checkbox": {
44
44
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.1_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._90324f97b7190ccfdbe40a9e8bef3385/node_modules/@openai/apps-sdk-ui/dist/es/components/Checkbox/index.js",
45
45
  "file": "@openai_apps-sdk-ui_components_Checkbox.js",
46
- "fileHash": "29d0dea7",
46
+ "fileHash": "e87c4e4e",
47
47
  "needsInterop": false
48
48
  },
49
49
  "@openai/apps-sdk-ui/components/Icon": {
50
50
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.1_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._90324f97b7190ccfdbe40a9e8bef3385/node_modules/@openai/apps-sdk-ui/dist/es/components/Icon/index.js",
51
51
  "file": "@openai_apps-sdk-ui_components_Icon.js",
52
- "fileHash": "95e0a6a4",
52
+ "fileHash": "5c946825",
53
53
  "needsInterop": false
54
54
  },
55
55
  "@openai/apps-sdk-ui/components/Input": {
56
56
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.1_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._90324f97b7190ccfdbe40a9e8bef3385/node_modules/@openai/apps-sdk-ui/dist/es/components/Input/index.js",
57
57
  "file": "@openai_apps-sdk-ui_components_Input.js",
58
- "fileHash": "2ee1f0e9",
58
+ "fileHash": "e5d8b16c",
59
59
  "needsInterop": false
60
60
  },
61
61
  "@openai/apps-sdk-ui/components/SegmentedControl": {
62
62
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.1_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._90324f97b7190ccfdbe40a9e8bef3385/node_modules/@openai/apps-sdk-ui/dist/es/components/SegmentedControl/index.js",
63
63
  "file": "@openai_apps-sdk-ui_components_SegmentedControl.js",
64
- "fileHash": "dc2c1206",
64
+ "fileHash": "4494f051",
65
65
  "needsInterop": false
66
66
  },
67
67
  "@openai/apps-sdk-ui/components/Select": {
68
68
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.1_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._90324f97b7190ccfdbe40a9e8bef3385/node_modules/@openai/apps-sdk-ui/dist/es/components/Select/index.js",
69
69
  "file": "@openai_apps-sdk-ui_components_Select.js",
70
- "fileHash": "a47ecdc0",
70
+ "fileHash": "e67a1bb8",
71
71
  "needsInterop": false
72
72
  },
73
73
  "@openai/apps-sdk-ui/components/Textarea": {
74
74
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.1_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._90324f97b7190ccfdbe40a9e8bef3385/node_modules/@openai/apps-sdk-ui/dist/es/components/Textarea/index.js",
75
75
  "file": "@openai_apps-sdk-ui_components_Textarea.js",
76
- "fileHash": "f4d46402",
76
+ "fileHash": "c9eb4f91",
77
77
  "needsInterop": false
78
78
  },
79
79
  "@openai/apps-sdk-ui/theme": {
80
80
  "src": "../../../../node_modules/.pnpm/@openai+apps-sdk-ui@0.2.1_@types+react-dom@19.2.3_@types+react@19.2.7__@types+react@19._90324f97b7190ccfdbe40a9e8bef3385/node_modules/@openai/apps-sdk-ui/dist/es/lib/theme.js",
81
81
  "file": "@openai_apps-sdk-ui_theme.js",
82
- "fileHash": "dcdfa91c",
82
+ "fileHash": "8d57b3ed",
83
83
  "needsInterop": false
84
84
  },
85
85
  "clsx": {
86
86
  "src": "../../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs",
87
87
  "file": "clsx.js",
88
- "fileHash": "0fcca76e",
88
+ "fileHash": "e10bef76",
89
89
  "needsInterop": false
90
90
  },
91
91
  "embla-carousel-react": {
92
92
  "src": "../../../../node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.3/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js",
93
93
  "file": "embla-carousel-react.js",
94
- "fileHash": "067c2552",
94
+ "fileHash": "6d9c07d5",
95
95
  "needsInterop": false
96
96
  },
97
97
  "embla-carousel-wheel-gestures": {
98
98
  "src": "../../../../node_modules/.pnpm/embla-carousel-wheel-gestures@8.1.0_embla-carousel@8.6.0/node_modules/embla-carousel-wheel-gestures/dist/embla-carousel-wheel-gestures.esm.js",
99
99
  "file": "embla-carousel-wheel-gestures.js",
100
- "fileHash": "e04a6e93",
100
+ "fileHash": "3f6f688e",
101
101
  "needsInterop": false
102
102
  },
103
103
  "mapbox-gl": {
104
104
  "src": "../../../../node_modules/.pnpm/mapbox-gl@3.17.0/node_modules/mapbox-gl/dist/mapbox-gl.js",
105
105
  "file": "mapbox-gl.js",
106
- "fileHash": "d775d38f",
106
+ "fileHash": "7f66cd45",
107
107
  "needsInterop": true
108
108
  },
109
109
  "react-dom/client": {
110
110
  "src": "../../../../node_modules/.pnpm/react-dom@19.2.3_react@19.2.3/node_modules/react-dom/client.js",
111
111
  "file": "react-dom_client.js",
112
- "fileHash": "f7f59ced",
112
+ "fileHash": "c9a3870a",
113
113
  "needsInterop": true
114
114
  },
115
115
  "tailwind-merge": {
116
116
  "src": "../../../../node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.mjs",
117
117
  "file": "tailwind-merge.js",
118
- "fileHash": "7c57bcda",
118
+ "fileHash": "9262acf9",
119
119
  "needsInterop": false
120
120
  }
121
121
  },
122
122
  "chunks": {
123
- "chunk-TSEQUROC": {
124
- "file": "chunk-TSEQUROC.js"
125
- },
126
- "chunk-XZTIOEPG": {
127
- "file": "chunk-XZTIOEPG.js"
128
- },
129
- "chunk-SPYXUHEY": {
130
- "file": "chunk-SPYXUHEY.js"
123
+ "chunk-2DZGWGIP": {
124
+ "file": "chunk-2DZGWGIP.js"
131
125
  },
132
- "chunk-UM3ZGDFR": {
133
- "file": "chunk-UM3ZGDFR.js"
126
+ "chunk-N6DVYEXK": {
127
+ "file": "chunk-N6DVYEXK.js"
134
128
  },
135
129
  "chunk-JAGHY6H6": {
136
130
  "file": "chunk-JAGHY6H6.js"
137
131
  },
138
- "chunk-DYQDWJMS": {
139
- "file": "chunk-DYQDWJMS.js"
140
- },
141
- "chunk-2DZGWGIP": {
142
- "file": "chunk-2DZGWGIP.js"
143
- },
144
132
  "chunk-QPJAV452": {
145
133
  "file": "chunk-QPJAV452.js"
146
134
  },
135
+ "chunk-DYQDWJMS": {
136
+ "file": "chunk-DYQDWJMS.js"
137
+ },
147
138
  "chunk-EGRHWZRV": {
148
139
  "file": "chunk-EGRHWZRV.js"
149
140
  },
141
+ "chunk-TSEQUROC": {
142
+ "file": "chunk-TSEQUROC.js"
143
+ },
144
+ "chunk-XZTIOEPG": {
145
+ "file": "chunk-XZTIOEPG.js"
146
+ },
150
147
  "chunk-CNYJBM5F": {
151
148
  "file": "chunk-CNYJBM5F.js"
152
149
  },
150
+ "chunk-UM3ZGDFR": {
151
+ "file": "chunk-UM3ZGDFR.js"
152
+ },
153
153
  "chunk-JGVISENQ": {
154
154
  "file": "chunk-JGVISENQ.js"
155
155
  },
@@ -1,10 +1,9 @@
1
- import {
2
- Check_default,
3
- Copy_default
4
- } from "./chunk-UM3ZGDFR.js";
5
1
  import {
6
2
  useTimeout
7
3
  } from "./chunk-JAGHY6H6.js";
4
+ import {
5
+ o
6
+ } from "./chunk-QPJAV452.js";
8
7
  import {
9
8
  handlePressableMouseEnter,
10
9
  isDev,
@@ -16,12 +15,13 @@ import {
16
15
  toTransformProperty,
17
16
  waitForAnimationFrame
18
17
  } from "./chunk-DYQDWJMS.js";
19
- import {
20
- o
21
- } from "./chunk-QPJAV452.js";
22
18
  import {
23
19
  clsx_default
24
20
  } from "./chunk-CNYJBM5F.js";
21
+ import {
22
+ Check_default,
23
+ Copy_default
24
+ } from "./chunk-UM3ZGDFR.js";
25
25
  import {
26
26
  require_jsx_runtime
27
27
  } from "./chunk-JGVISENQ.js";
@@ -625,4 +625,4 @@ export {
625
625
  ButtonLink,
626
626
  CopyButton
627
627
  };
628
- //# sourceMappingURL=chunk-SPYXUHEY.js.map
628
+ //# sourceMappingURL=chunk-N6DVYEXK.js.map
@@ -1 +1 @@
1
- {"version":"4.0.16","results":[[":src/resources/carousel-resource.test.tsx",{"duration":296.55490899999995,"failed":false}],[":src/components/album/albums.test.tsx",{"duration":458.741951,"failed":false}],[":src/resources/counter-resource.test.tsx",{"duration":277.258836,"failed":false}],[":src/components/map/map-view.test.tsx",{"duration":81.79789200000005,"failed":false}],[":src/components/map/place-inspector.test.tsx",{"duration":410.6831910000001,"failed":false}],[":src/components/album/fullscreen-viewer.test.tsx",{"duration":288.4420110000001,"failed":false}],[":src/components/map/place-list.test.tsx",{"duration":146.148862,"failed":false}],[":src/components/map/place-card.test.tsx",{"duration":344.8966650000002,"failed":false}],[":src/components/map/place-carousel.test.tsx",{"duration":427.75209400000017,"failed":false}],[":src/components/album/album-carousel.test.tsx",{"duration":73.333216,"failed":false}],[":src/components/carousel/carousel.test.tsx",{"duration":69.63533200000006,"failed":false}],[":src/resources/albums-resource.test.tsx",{"duration":241.26836400000002,"failed":false}],[":src/components/album/film-strip.test.tsx",{"duration":446.91730400000006,"failed":false}],[":src/components/album/album-card.test.tsx",{"duration":284.9094,"failed":false}],[":src/components/carousel/card.test.tsx",{"duration":71.40019499999994,"failed":false}]]}
1
+ {"version":"4.0.16","results":[[":src/components/album/albums.test.tsx",{"duration":334.697216,"failed":false}],[":src/resources/review-resource.test.tsx",{"duration":555.3965230000001,"failed":false}],[":src/resources/carousel-resource.test.tsx",{"duration":255.80494199999998,"failed":false}],[":src/components/map/map-view.test.tsx",{"duration":80.3751279999999,"failed":false}],[":src/components/map/place-inspector.test.tsx",{"duration":425.41421500000024,"failed":false}],[":src/components/album/fullscreen-viewer.test.tsx",{"duration":254.88947699999972,"failed":false}],[":src/components/map/place-list.test.tsx",{"duration":128.85422500000004,"failed":false}],[":src/components/map/place-card.test.tsx",{"duration":346.91089099999976,"failed":false}],[":src/components/map/place-carousel.test.tsx",{"duration":450.42473600000017,"failed":false}],[":src/components/album/album-carousel.test.tsx",{"duration":95.884546,"failed":false}],[":src/components/carousel/carousel.test.tsx",{"duration":82.93981499999995,"failed":false}],[":src/resources/map-resource.test.tsx",{"duration":289.9950490000001,"failed":false}],[":src/resources/albums-resource.test.tsx",{"duration":250.440699,"failed":false}],[":src/components/album/film-strip.test.tsx",{"duration":397.1800680000001,"failed":false}],[":src/components/carousel/card.test.tsx",{"duration":74.95684000000006,"failed":false}],[":src/components/album/album-card.test.tsx",{"duration":283.6294740000001,"failed":false}]]}
@@ -2,11 +2,11 @@
2
2
  * Auto-discovers and re-exports all resource components.
3
3
  *
4
4
  * Discovers all *-resource.tsx files and exports their component
5
- * with a PascalCase name (e.g., counter-resource.tsx -> CounterResource).
5
+ * with a PascalCase name (e.g., review-resource.tsx -> ReviewResource).
6
6
  *
7
7
  * Supports both export styles:
8
8
  * - Default export: export default MyComponent
9
- * - Named export: export const CounterResource = ...
9
+ * - Named export: export const ReviewResource = ...
10
10
  */
11
11
 
12
12
  // Auto-discover all resource component files
@@ -16,12 +16,12 @@ const resourceModules = import.meta.glob('./*-resource.tsx', { eager: true });
16
16
  const resources: Record<string, React.ComponentType> = {};
17
17
 
18
18
  for (const [path, module] of Object.entries(resourceModules)) {
19
- // Extract key from path: './counter-resource.tsx' -> 'counter'
19
+ // Extract key from path: './review-resource.tsx' -> 'review'
20
20
  const match = path.match(/\.\/(.+)-resource\.tsx$/);
21
21
  const key = match?.[1];
22
22
  if (!key) continue;
23
23
 
24
- // Convert to PascalCase and append 'Resource': 'counter' -> 'CounterResource'
24
+ // Convert to PascalCase and append 'Resource': 'review' -> 'ReviewResource'
25
25
  const pascalKey = key.charAt(0).toUpperCase() + key.slice(1);
26
26
  const exportName = `${pascalKey}Resource`;
27
27
 
@@ -0,0 +1,95 @@
1
+ import { render } from '@testing-library/react';
2
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
3
+ import { MapResource } from './map-resource';
4
+
5
+ // Mock sunpeak hooks
6
+ let mockSafeArea: { insets: { top: number; bottom: number; left: number; right: number } } | null =
7
+ {
8
+ insets: { top: 0, bottom: 0, left: 0, right: 0 },
9
+ };
10
+ let mockMaxHeight: number | null = 600;
11
+
12
+ vi.mock('sunpeak', () => ({
13
+ useSafeArea: () => mockSafeArea,
14
+ useMaxHeight: () => mockMaxHeight,
15
+ }));
16
+
17
+ // Mock the Map component
18
+ vi.mock('../components/map/map', () => ({
19
+ Map: () => <div data-testid="map">Map Component</div>,
20
+ }));
21
+
22
+ describe('MapResource', () => {
23
+ beforeEach(() => {
24
+ vi.clearAllMocks();
25
+ mockSafeArea = { insets: { top: 0, bottom: 0, left: 0, right: 0 } };
26
+ mockMaxHeight = 600;
27
+ });
28
+
29
+ it('renders the Map component', () => {
30
+ const { getByTestId } = render(<MapResource />);
31
+
32
+ expect(getByTestId('map')).toBeInTheDocument();
33
+ });
34
+
35
+ it('respects safe area insets', () => {
36
+ mockSafeArea = { insets: { top: 20, bottom: 30, left: 10, right: 15 } };
37
+
38
+ const { container } = render(<MapResource />);
39
+ const mainDiv = container.firstChild as HTMLElement;
40
+
41
+ expect(mainDiv).toHaveStyle({
42
+ paddingTop: '20px',
43
+ paddingBottom: '30px',
44
+ paddingLeft: '10px',
45
+ paddingRight: '15px',
46
+ });
47
+ });
48
+
49
+ it('respects maxHeight constraint', () => {
50
+ mockMaxHeight = 400;
51
+
52
+ const { container } = render(<MapResource />);
53
+ const mainDiv = container.firstChild as HTMLElement;
54
+
55
+ expect(mainDiv).toHaveStyle({
56
+ maxHeight: '400px',
57
+ });
58
+ });
59
+
60
+ it('handles null safe area', () => {
61
+ mockSafeArea = null;
62
+
63
+ const { container } = render(<MapResource />);
64
+ const mainDiv = container.firstChild as HTMLElement;
65
+
66
+ expect(mainDiv).toHaveStyle({
67
+ paddingTop: '0px',
68
+ paddingBottom: '0px',
69
+ paddingLeft: '0px',
70
+ paddingRight: '0px',
71
+ });
72
+ });
73
+
74
+ it('handles null maxHeight', () => {
75
+ mockMaxHeight = null;
76
+
77
+ const { container } = render(<MapResource />);
78
+ const mainDiv = container.firstChild as HTMLElement;
79
+
80
+ // maxHeight should not be set when null
81
+ expect(mainDiv.style.maxHeight).toBe('');
82
+ });
83
+
84
+ it('forwards ref to the container div', () => {
85
+ const ref = vi.fn();
86
+ render(<MapResource ref={ref} />);
87
+
88
+ expect(ref).toHaveBeenCalled();
89
+ expect(ref.mock.calls[0][0]).toBeInstanceOf(HTMLDivElement);
90
+ });
91
+
92
+ it('has the correct displayName', () => {
93
+ expect(MapResource.displayName).toBe('MapResource');
94
+ });
95
+ });