@shipload/item-renderer 0.1.4 → 0.2.0
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.
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/links.ts +5 -0
- package/src/meta.ts +4 -20
- package/src/templates/resource.ts +7 -7
- package/src/tokens/colors.ts +5 -5
- package/test/__image_snapshots__/component-hull-plates.png +0 -0
- package/test/__image_snapshots__/module-storage-t1.png +0 -0
- package/test/__image_snapshots__/packed-entity-ship-t1-only-engine.png +0 -0
- package/test/__image_snapshots__/packed-entity-ship-t1-two-modules.png +0 -0
- package/test/__image_snapshots__/resource-ore-t1.png +0 -0
- package/test/__snapshots__/templates-component.test.ts.snap +2 -2
- package/test/__snapshots__/templates-item-cell.test.ts.snap +1 -1
- package/test/__snapshots__/templates-module.test.ts.snap +2 -2
- package/test/__snapshots__/templates-packed-entity.test.ts.snap +2 -2
- package/test/__snapshots__/templates-resource.test.ts.snap +3 -3
- package/test/codec.test.ts +1 -1
- package/test/fixtures/cargo-items.ts +9 -9
- package/test/links-meta.test.ts +17 -10
- package/test/pixel.test.ts +1 -1
- package/test/render.test.ts +5 -5
- package/test/sdk-link.test.ts +5 -5
- package/test/templates-dispatch.test.ts +2 -2
- package/test/templates-item-cell.test.ts +3 -3
- package/test/templates-packed-entity.test.ts +2 -2
- package/test/templates-resource.test.ts +15 -15
- package/test/tokens.test.ts +1 -1
- package/test/__image_snapshots__/packed-entity-ship-t1-two-modules.diff.png +0 -0
- package/test/__image_snapshots__/resource-iron.diff.png +0 -0
- package/test/__image_snapshots__/resource-iron.png +0 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { renderItem, renderFromPayload, type RenderOptions } from './render.ts'
|
|
|
13
13
|
export { renderByType, type RenderByTypeOpts } from './templates/index.ts'
|
|
14
14
|
|
|
15
15
|
// Links + meta
|
|
16
|
-
export { linkToItemPage, linkToItemImage } from './links.ts'
|
|
16
|
+
export { linkToItemPage, linkToItemImage, linkToItemSocial } from './links.ts'
|
|
17
17
|
export { itemPageMeta, svgDimensions } from './meta.ts'
|
|
18
18
|
export type { ItemPageMeta, ItemPageMetaOptions } from './meta.ts'
|
|
19
19
|
|
package/src/links.ts
CHANGED
|
@@ -17,3 +17,8 @@ export function linkToItemImage(
|
|
|
17
17
|
const payload = encodePayload(item)
|
|
18
18
|
return `${baseUrl}/item/${payload}.${ext}`
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
export function linkToItemSocial(item: CargoItem, baseUrl = DEFAULT_IMAGE_BASE): string {
|
|
22
|
+
const payload = encodePayload(item)
|
|
23
|
+
return `${baseUrl}/social/${payload}.png`
|
|
24
|
+
}
|
package/src/meta.ts
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
import type { ResolvedItem } from '@shipload/sdk'
|
|
2
|
+
import { describeItem, displayName } from '@shipload/sdk'
|
|
2
3
|
import type { CargoItem } from './payload/codec.ts'
|
|
3
|
-
import {
|
|
4
|
+
import { linkToItemSocial } from './links.ts'
|
|
4
5
|
import { SOCIAL_CARD_WIDTH, SOCIAL_CARD_HEIGHT } from './templates/social-card.ts'
|
|
5
6
|
|
|
6
|
-
function tierLabel(tier: string): string {
|
|
7
|
-
return tier.toUpperCase()
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function categoryLabel(resolved: ResolvedItem): string {
|
|
11
|
-
if (!resolved.category) return ''
|
|
12
|
-
return resolved.category[0]!.toUpperCase() + resolved.category.slice(1)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function describeItem(resolved: ResolvedItem): string {
|
|
16
|
-
const parts: string[] = []
|
|
17
|
-
if (resolved.category) parts.push(categoryLabel(resolved))
|
|
18
|
-
parts.push(tierLabel(resolved.tier))
|
|
19
|
-
parts.push(`${resolved.mass.toLocaleString('en-US')} kg`)
|
|
20
|
-
return parts.join(' · ')
|
|
21
|
-
}
|
|
22
|
-
|
|
23
7
|
const DIMS_RE = /<svg[^>]*?\bwidth="(\d+)"[^>]*?\bheight="(\d+)"/
|
|
24
8
|
|
|
25
9
|
export function svgDimensions(svg: string): { width: number; height: number } {
|
|
@@ -46,9 +30,9 @@ export function itemPageMeta(
|
|
|
46
30
|
opts?: ItemPageMetaOptions,
|
|
47
31
|
): ItemPageMeta {
|
|
48
32
|
return {
|
|
49
|
-
title: `${resolved
|
|
33
|
+
title: `${displayName(resolved)} · Shipload Guide`,
|
|
50
34
|
description: describeItem(resolved),
|
|
51
|
-
ogImage:
|
|
35
|
+
ogImage: linkToItemSocial(item, opts?.imageBaseUrl),
|
|
52
36
|
ogImageWidth: SOCIAL_CARD_WIDTH,
|
|
53
37
|
ogImageHeight: SOCIAL_CARD_HEIGHT,
|
|
54
38
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResolvedItem } from '@shipload/sdk'
|
|
2
|
-
import { getStatDefinitions, categoryColors } from '@shipload/sdk'
|
|
2
|
+
import { getStatDefinitions, categoryColors, displayName } from '@shipload/sdk'
|
|
3
3
|
import type { CargoItem } from '../payload/codec.ts'
|
|
4
4
|
import { panel } from '../primitives/panel.ts'
|
|
5
5
|
import { iconHex } from '../primitives/icon-hex.ts'
|
|
@@ -11,11 +11,11 @@ import { tokens } from '../tokens/index.ts'
|
|
|
11
11
|
import { shortCode, formatMass, tierBorder } from './_shared.ts'
|
|
12
12
|
|
|
13
13
|
const CATEGORY_LABELS: Record<string, string> = {
|
|
14
|
-
|
|
14
|
+
ore: 'Ore',
|
|
15
|
+
crystal: 'Crystal',
|
|
15
16
|
gas: 'Gas',
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
precious: 'Precious',
|
|
17
|
+
regolith: 'Regolith',
|
|
18
|
+
biomass: 'Biomass',
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
function categoryColor(category?: string): string {
|
|
@@ -89,13 +89,13 @@ export function renderResource(
|
|
|
89
89
|
const name = text({
|
|
90
90
|
x: pad + 34,
|
|
91
91
|
y: pad + 22,
|
|
92
|
-
value: resolved
|
|
92
|
+
value: displayName(resolved),
|
|
93
93
|
size: tokens.typography.sizes.title,
|
|
94
94
|
weight: 700,
|
|
95
95
|
family: tokens.typography.display,
|
|
96
96
|
})
|
|
97
97
|
|
|
98
|
-
const catLabel = CATEGORY_LABELS[
|
|
98
|
+
const catLabel = resolved.category ? (CATEGORY_LABELS[resolved.category] ?? 'Item') : 'Item'
|
|
99
99
|
const catText = text({
|
|
100
100
|
x: pad,
|
|
101
101
|
y: pad + headerH + 4,
|
package/src/tokens/colors.ts
CHANGED
|
@@ -19,11 +19,11 @@ export const colors = {
|
|
|
19
19
|
cyan: '#6cb9ff',
|
|
20
20
|
},
|
|
21
21
|
category: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
ore: '#C26D3F',
|
|
23
|
+
crystal: '#4ADBFF',
|
|
24
|
+
gas: '#B8E4A0',
|
|
25
|
+
regolith: '#C4A57B',
|
|
26
|
+
biomass: '#5A8B3E',
|
|
27
27
|
},
|
|
28
28
|
tier: tierColors,
|
|
29
29
|
accent: {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
2
|
|
|
3
|
-
exports[`matches the committed Hull Plates snapshot: component-hull-plates.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="164" viewBox="0 0 280 164"><rect x="0.5" y="0.5" width="279" height="163" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#8f98a8" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#8f98a8" text-anchor="middle">01</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Hull Plates</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Type</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">COMPONENT · T1</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">50,000</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="108" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#
|
|
3
|
+
exports[`matches the committed Hull Plates snapshot: component-hull-plates.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="164" viewBox="0 0 280 164"><rect x="0.5" y="0.5" width="279" height="163" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#8f98a8" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#8f98a8" text-anchor="middle">01</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Hull Plates</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Type</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">COMPONENT · T1</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">50,000</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="108" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#C26D3F">STR</text><text x="36" y="108" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Strength</text><text x="266" y="108" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="14" font-weight="700" fill="#C26D3F" text-anchor="end">745</text><rect x="14" y="114" width="252" height="4" rx="2" ry="2" fill="#1e242e"/><rect x="14" y="114" width="183" height="4" rx="2" ry="2" fill="#C26D3F"/><text x="14" y="134" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#C26D3F">DEN</text><text x="36" y="134" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Density</text><text x="266" y="134" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="14" font-weight="700" fill="#C26D3F" text-anchor="end">330</text><rect x="14" y="140" width="252" height="4" rx="2" ry="2" fill="#1e242e"/><rect x="14" y="140" width="170" height="4" rx="2" ry="2" fill="#C26D3F"/></svg>"`;
|
|
4
4
|
|
|
5
|
-
exports[`renderComponent ranges mode matches snapshot: component-ranges 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="164" viewBox="0 0 280 164"><rect x="0.5" y="0.5" width="279" height="163" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#8f98a8" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#8f98a8" text-anchor="middle">01</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Hull Plates</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Type</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">COMPONENT · T1</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">50,000</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="108" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#
|
|
5
|
+
exports[`renderComponent ranges mode matches snapshot: component-ranges 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="164" viewBox="0 0 280 164"><rect x="0.5" y="0.5" width="279" height="163" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#8f98a8" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#8f98a8" text-anchor="middle">01</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Hull Plates</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Type</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">COMPONENT · T1</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">50,000</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="108" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#C26D3F">STR</text><text x="36" y="108" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Strength</text><rect x="14" y="114" width="252" height="4" rx="2" ry="2" fill="#1e242e"/><text x="14" y="134" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#C26D3F">DEN</text><text x="36" y="134" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Density</text><rect x="14" y="140" width="252" height="4" rx="2" ry="2" fill="#1e242e"/></svg>"`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
2
|
|
|
3
|
-
exports[`matches golden SVG snapshot per itemType: item-cell-resource 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="48" height="60" viewBox="0 0 48 60"><rect x="0.5" y="0.5" width="47" height="59" rx="6" ry="6" fill="#11141a" stroke="#8b8b8b" stroke-width="1.5"/><polygon points="24.00,11.52 30.65,15.36 30.65,23.04 24.00,26.88 17.35,23.04 17.35,15.36" fill="none" stroke="#
|
|
3
|
+
exports[`matches golden SVG snapshot per itemType: item-cell-resource 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="48" height="60" viewBox="0 0 48 60"><rect x="0.5" y="0.5" width="47" height="59" rx="6" ry="6" fill="#11141a" stroke="#8b8b8b" stroke-width="1.5"/><polygon points="24.00,11.52 30.65,15.36 30.65,23.04 24.00,26.88 17.35,23.04 17.35,15.36" fill="none" stroke="#C26D3F" stroke-width="1.5" stroke-linejoin="round"/><text x="42" y="54" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="11" font-weight="700" fill="#e6e8ec" text-anchor="end">3</text></svg>"`;
|
|
4
4
|
|
|
5
5
|
exports[`matches golden SVG snapshot per itemType: item-cell-component 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="48" height="60" viewBox="0 0 48 60"><rect x="0.5" y="0.5" width="47" height="59" rx="6" ry="6" fill="#11141a" stroke="#8b8b8b" stroke-width="1.5"/><text x="24" y="21.6" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="13" font-weight="700" fill="#e6e8ec" text-anchor="middle">HP</text><text x="42" y="54" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="11" font-weight="700" fill="#e6e8ec" text-anchor="end">3</text></svg>"`;
|
|
6
6
|
|
|
@@ -10,8 +10,8 @@ exports[`matches the committed loaderT1 snapshot: module-loaderT1.svg 1`] = `"<s
|
|
|
10
10
|
|
|
11
11
|
exports[`matches the committed crafterT1 snapshot: module-crafterT1.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="160" viewBox="0 0 280 160"><rect x="0.5" y="0.5" width="279" height="159" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#a855f7" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#a855f7" text-anchor="middle">04</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Manufacturing</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Type</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">MODULE · T1</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">0</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="112" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="11" font-weight="700" fill="#a855f7" letter-spacing="1">MANUFACTURING</text><text x="14" y="132" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">manufactures items at </tspan><tspan fill="#f4c96b">580</tspan><tspan fill="#8f98a8"> speed</tspan></text><text x="14" y="146" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">while draining </tspan><tspan fill="#f4c96b">15</tspan><tspan fill="#8f98a8"> energy per second</tspan></text></svg>"`;
|
|
12
12
|
|
|
13
|
-
exports[`matches the committed storageT1 snapshot: module-storageT1.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="146" viewBox="0 0 280 146"><rect x="0.5" y="0.5" width="279" height="145" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#14b8a6" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#14b8a6" text-anchor="middle">05</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Storage</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Type</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">MODULE · T1</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">0</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="112" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="11" font-weight="700" fill="#14b8a6" letter-spacing="1">STORAGE</text><text x="14" y="132" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">boosts cargo capacity by </tspan><tspan fill="#f4c96b">
|
|
13
|
+
exports[`matches the committed storageT1 snapshot: module-storageT1.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="146" viewBox="0 0 280 146"><rect x="0.5" y="0.5" width="279" height="145" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#14b8a6" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#14b8a6" text-anchor="middle">05</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Storage</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Type</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">MODULE · T1</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">0</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="112" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="11" font-weight="700" fill="#14b8a6" letter-spacing="1">STORAGE</text><text x="14" y="132" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">boosts cargo capacity by </tspan><tspan fill="#f4c96b">16</tspan><tspan fill="#8f98a8">%</tspan></text></svg>"`;
|
|
14
14
|
|
|
15
|
-
exports[`matches the committed haulerT1 snapshot: module-haulerT1.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="174" viewBox="0 0 280 174"><rect x="0.5" y="0.5" width="279" height="173" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#f97316" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#f97316" text-anchor="middle">06</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Hauler
|
|
15
|
+
exports[`matches the committed haulerT1 snapshot: module-haulerT1.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="174" viewBox="0 0 280 174"><rect x="0.5" y="0.5" width="279" height="173" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#f97316" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#f97316" text-anchor="middle">06</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Hauler</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Type</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">MODULE · T1</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">0</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="112" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="11" font-weight="700" fill="#f97316" letter-spacing="1">HAULER</text><text x="14" y="132" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">locks onto up to </tspan><tspan fill="#f4c96b">2</tspan><tspan fill="#8f98a8"> targets at </tspan><tspan fill="#f4c96b">2,000</tspan></text><text x="14" y="146" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">efficiency while draining </tspan><tspan fill="#f4c96b">15</tspan><tspan fill="#8f98a8"> energy</tspan></text><text x="14" y="160" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">per distance travelled per target</tspan></text></svg>"`;
|
|
16
16
|
|
|
17
17
|
exports[`renderModule ranges mode matches snapshot: module-ranges 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="132" viewBox="0 0 280 132"><rect x="0.5" y="0.5" width="279" height="131" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#4a8abf" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#4a8abf" text-anchor="middle">00</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Engine</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Type</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">MODULE · T1</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">0</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="112" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="11" font-weight="700" fill="#4a8abf" letter-spacing="1">ENGINE</text></svg>"`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
2
|
|
|
3
|
-
exports[`matches the committed Ship T1 (two modules) snapshot: packed-entity-ship-t1-two-modules.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="314" viewBox="0 0 280 314"><rect x="0.5" y="0.5" width="279" height="313" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#f4c96b" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#f4c96b" text-anchor="middle">SH</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Ship
|
|
3
|
+
exports[`matches the committed Ship T1 (two modules) snapshot: packed-entity-ship-t1-two-modules.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="314" viewBox="0 0 280 314"><rect x="0.5" y="0.5" width="279" height="313" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#f4c96b" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#f4c96b" text-anchor="middle">SH</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Ship (Packed)</text><text x="14" y="62" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="11" font-weight="700" fill="#8f98a8" letter-spacing="1">HULL</text><text x="14" y="80" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="80" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="700" fill="#e6e8ec" text-anchor="end">25,000</text><line x1="14" x2="266" y1="86" y2="86" stroke="#2a3340" stroke-width="1"/><text x="14" y="102" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Capacity</text><text x="266" y="102" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="700" fill="#e6e8ec" text-anchor="end">1,000,000</text><line x1="14" x2="266" y1="108" y2="108" stroke="#2a3340" stroke-width="1"/><polygon points="20,125 25,130 20,135 15,130" fill="#2fd6d1"/><text x="34" y="133" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan font-weight="600" fill="#e6e8ec">Engine: </tspan><tspan fill="#8f98a8">generates </tspan><tspan fill="#f4c96b">598</tspan><tspan fill="#8f98a8"> thrust for</tspan></text><text x="34" y="147" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">travel while draining </tspan><tspan fill="#f4c96b">47</tspan><tspan fill="#8f98a8"> energy per</tspan></text><text x="34" y="161" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">distance travelled</tspan></text><polygon points="20,177 25,182 20,187 15,182" fill="#2fd6d1"/><text x="34" y="185" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan font-weight="600" fill="#e6e8ec">Generator: </tspan><tspan fill="#8f98a8">holds </tspan><tspan fill="#f4c96b">456</tspan><tspan fill="#8f98a8"> maximum energy</tspan></text><text x="34" y="199" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">and restores </tspan><tspan fill="#f4c96b">3</tspan><tspan fill="#8f98a8"> per second while</tspan></text><text x="34" y="213" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">recharging</tspan></text><polygon points="20,229 25,234 20,239 15,234" fill="none" stroke="#2a3340" stroke-width="1"/><text x="34" y="237" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#5b6373">Empty module</text><polygon points="20,253 25,258 20,263 15,258" fill="none" stroke="#2a3340" stroke-width="1"/><text x="34" y="261" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#5b6373">Empty module</text><polygon points="20,277 25,282 20,287 15,282" fill="none" stroke="#2a3340" stroke-width="1"/><text x="34" y="285" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#5b6373">Empty module</text></svg>"`;
|
|
4
4
|
|
|
5
|
-
exports[`matches the committed Ship T1 (only engine) snapshot: packed-entity-ship-t1-only-engine.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="286" viewBox="0 0 280 286"><rect x="0.5" y="0.5" width="279" height="285" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#f4c96b" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#f4c96b" text-anchor="middle">SH</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Ship
|
|
5
|
+
exports[`matches the committed Ship T1 (only engine) snapshot: packed-entity-ship-t1-only-engine.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="286" viewBox="0 0 280 286"><rect x="0.5" y="0.5" width="279" height="285" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#f4c96b" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#f4c96b" text-anchor="middle">SH</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Ship (Packed)</text><text x="14" y="62" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="11" font-weight="700" fill="#8f98a8" letter-spacing="1">HULL</text><text x="14" y="80" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="80" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="700" fill="#e6e8ec" text-anchor="end">25,000</text><line x1="14" x2="266" y1="86" y2="86" stroke="#2a3340" stroke-width="1"/><text x="14" y="102" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Capacity</text><text x="266" y="102" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="700" fill="#e6e8ec" text-anchor="end">1,000,000</text><line x1="14" x2="266" y1="108" y2="108" stroke="#2a3340" stroke-width="1"/><polygon points="20,125 25,130 20,135 15,130" fill="#2fd6d1"/><text x="34" y="133" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan font-weight="600" fill="#e6e8ec">Engine: </tspan><tspan fill="#8f98a8">generates </tspan><tspan fill="#f4c96b">598</tspan><tspan fill="#8f98a8"> thrust for</tspan></text><text x="34" y="147" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">travel while draining </tspan><tspan fill="#f4c96b">47</tspan><tspan fill="#8f98a8"> energy per</tspan></text><text x="34" y="161" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12"><tspan fill="#8f98a8">distance travelled</tspan></text><polygon points="20,177 25,182 20,187 15,182" fill="none" stroke="#2a3340" stroke-width="1"/><text x="34" y="185" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#5b6373">Empty module</text><polygon points="20,201 25,206 20,211 15,206" fill="none" stroke="#2a3340" stroke-width="1"/><text x="34" y="209" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#5b6373">Empty module</text><polygon points="20,225 25,230 20,235 15,230" fill="none" stroke="#2a3340" stroke-width="1"/><text x="34" y="233" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#5b6373">Empty module</text><polygon points="20,249 25,254 20,259 15,254" fill="none" stroke="#2a3340" stroke-width="1"/><text x="34" y="257" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#5b6373">Empty module</text></svg>"`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
2
|
|
|
3
|
-
exports[`matches the committed
|
|
3
|
+
exports[`matches the committed Crude Ore snapshot: resource-ore-t1.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="190" viewBox="0 0 280 190"><rect x="0.5" y="0.5" width="279" height="189" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#C26D3F" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#C26D3F" text-anchor="middle">01</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Crude Ore</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Category</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">Ore</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">30,000</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="108" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#C26D3F">STR</text><text x="36" y="108" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Strength</text><text x="266" y="108" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="14" font-weight="700" fill="#C26D3F" text-anchor="end">959</text><rect x="14" y="114" width="252" height="4" rx="2" ry="2" fill="#1e242e"/><rect x="14" y="114" width="236" height="4" rx="2" ry="2" fill="#C26D3F"/><text x="14" y="134" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#C26D3F">TOL</text><text x="36" y="134" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Tolerance</text><text x="266" y="134" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="14" font-weight="700" fill="#C26D3F" text-anchor="end">340</text><rect x="14" y="140" width="252" height="4" rx="2" ry="2" fill="#1e242e"/><rect x="14" y="140" width="83" height="4" rx="2" ry="2" fill="#C26D3F"/><text x="14" y="160" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#C26D3F">DEN</text><text x="36" y="160" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Density</text><text x="266" y="160" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="14" font-weight="700" fill="#C26D3F" text-anchor="end">59</text><rect x="14" y="166" width="252" height="4" rx="2" ry="2" fill="#1e242e"/><rect x="14" y="166" width="237" height="4" rx="2" ry="2" fill="#C26D3F"/></svg>"`;
|
|
4
4
|
|
|
5
|
-
exports[`matches the committed
|
|
5
|
+
exports[`matches the committed Dense Gas snapshot: resource-gas-t2.svg 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="190" viewBox="0 0 280 190"><rect x="0.5" y="0.5" width="279" height="189" rx="10" ry="10" fill="#11141a" stroke="#4ade80" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#B8E4A0" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#B8E4A0" text-anchor="middle">02</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Dense Gas</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Category</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">Gas</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">2,000</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="108" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#B8E4A0">VOL</text><text x="36" y="108" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Volatility</text><text x="266" y="108" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="14" font-weight="700" fill="#B8E4A0" text-anchor="end">898</text><rect x="14" y="114" width="252" height="4" rx="2" ry="2" fill="#1e242e"/><rect x="14" y="114" width="221" height="4" rx="2" ry="2" fill="#B8E4A0"/><text x="14" y="134" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#B8E4A0">REA</text><text x="36" y="134" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Reactivity</text><text x="266" y="134" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="14" font-weight="700" fill="#B8E4A0" text-anchor="end">728</text><rect x="14" y="140" width="252" height="4" rx="2" ry="2" fill="#1e242e"/><rect x="14" y="140" width="179" height="4" rx="2" ry="2" fill="#B8E4A0"/><text x="14" y="160" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#B8E4A0">THM</text><text x="36" y="160" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Thermal</text><text x="266" y="160" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="14" font-weight="700" fill="#B8E4A0" text-anchor="end">399</text><rect x="14" y="166" width="252" height="4" rx="2" ry="2" fill="#1e242e"/><rect x="14" y="166" width="98" height="4" rx="2" ry="2" fill="#B8E4A0"/></svg>"`;
|
|
6
6
|
|
|
7
|
-
exports[`renderResource ranges mode matches snapshot: resource-ranges 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="190" viewBox="0 0 280 190"><rect x="0.5" y="0.5" width="279" height="189" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#
|
|
7
|
+
exports[`renderResource ranges mode matches snapshot: resource-ranges 1`] = `"<svg xmlns="http://www.w3.org/2000/svg" width="280" height="190" viewBox="0 0 280 190"><rect x="0.5" y="0.5" width="279" height="189" rx="10" ry="10" fill="#11141a" stroke="#8b8b8b" stroke-width="1"/><polygon points="14.0,29.0 20.4,18.0 33.1,18.0 39.4,29.0 33.1,40.0 20.4,40.0" fill="none" stroke="#C26D3F" stroke-width="1.5"/><text x="26.701700000000002" y="32" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="9" font-weight="700" fill="#C26D3F" text-anchor="middle">01</text><text x="48" y="36" font-family=""Orbitron", "Orbitron Variable", system-ui, sans-serif" font-size="16" font-weight="700" fill="#e6e8ec">Crude Ore</text><text x="14" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Category</text><text x="266" y="66" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">Ore</text><text x="14" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#8f98a8">Mass</text><text x="266" y="82" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="600" fill="#e6e8ec" text-anchor="end">30,000</text><line x1="14" x2="266" y1="96" y2="96" stroke="#1e242e" stroke-width="1"/><text x="14" y="108" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#C26D3F">STR</text><text x="36" y="108" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Strength</text><rect x="14" y="114" width="252" height="4" rx="2" ry="2" fill="#1e242e"/><text x="14" y="134" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#C26D3F">TOL</text><text x="36" y="134" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Tolerance</text><rect x="14" y="140" width="252" height="4" rx="2" ry="2" fill="#1e242e"/><text x="14" y="160" font-family=""JetBrains Mono", "JetBrains Mono Variable", ui-monospace, monospace" font-size="10" font-weight="700" fill="#C26D3F">DEN</text><text x="36" y="160" font-family=""Inter", "Inter Variable", system-ui, sans-serif" font-size="12" font-weight="400" fill="#e6e8ec">Density</text><rect x="14" y="166" width="252" height="4" rx="2" ry="2" fill="#1e242e"/></svg>"`;
|
package/test/codec.test.ts
CHANGED
|
@@ -37,7 +37,7 @@ test('decodePayload throws InvalidPayloadError on malformed input', () => {
|
|
|
37
37
|
})
|
|
38
38
|
|
|
39
39
|
test('payload sizes are within expected ranges', () => {
|
|
40
|
-
expect(encodePayload(FIXTURES.
|
|
40
|
+
expect(encodePayload(FIXTURES.oreT1).length).toBeLessThan(30)
|
|
41
41
|
expect(encodePayload(FIXTURES.shipT1NoModules).length).toBeLessThan(30)
|
|
42
42
|
expect(encodePayload(FIXTURES.shipT1TwoModules).length).toBeLessThan(110)
|
|
43
43
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ServerContract } from '@shipload/sdk'
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
3
|
+
export const ITEM_ORE_T1 = 101
|
|
4
|
+
export const ITEM_GAS_T2 = 302
|
|
5
5
|
export const ITEM_ENGINE_T1 = 10100
|
|
6
6
|
export const ITEM_GENERATOR_T1 = 10101
|
|
7
7
|
export const ITEM_GATHERER_T1 = 10102
|
|
@@ -14,9 +14,9 @@ export const ITEM_SHIP_T1_PACKED = 10201
|
|
|
14
14
|
export const MODULE_ENGINE = 1
|
|
15
15
|
export const MODULE_GENERATOR = 2
|
|
16
16
|
|
|
17
|
-
export function
|
|
17
|
+
export function cargoOreT1(stats = '0x123456789ABCDEF', quantity = 1) {
|
|
18
18
|
return ServerContract.Types.cargo_item.from({
|
|
19
|
-
item_id:
|
|
19
|
+
item_id: ITEM_ORE_T1,
|
|
20
20
|
quantity,
|
|
21
21
|
stats,
|
|
22
22
|
modules: [],
|
|
@@ -52,11 +52,11 @@ export function cargoShipT1Packed(opts?: {
|
|
|
52
52
|
export const ITEM_HULL_PLATES = 10001
|
|
53
53
|
|
|
54
54
|
export const FIXTURES = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
item_id:
|
|
55
|
+
oreT1: cargoOreT1('0x123456789ABCDEF'),
|
|
56
|
+
oreT1StackOf50: cargoOreT1('0x123456789ABCDEF', 50),
|
|
57
|
+
oreT1ZeroStats: cargoOreT1('0'),
|
|
58
|
+
gasT2: ServerContract.Types.cargo_item.from({
|
|
59
|
+
item_id: ITEM_GAS_T2,
|
|
60
60
|
quantity: 1,
|
|
61
61
|
stats: '0xDEADBEEF1234',
|
|
62
62
|
modules: [],
|
package/test/links-meta.test.ts
CHANGED
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
import { expect, test } from 'bun:test'
|
|
2
2
|
import { resolveItem } from '@shipload/sdk'
|
|
3
|
-
import { linkToItemImage, linkToItemPage } from '../src/links.ts'
|
|
3
|
+
import { linkToItemImage, linkToItemPage, linkToItemSocial } from '../src/links.ts'
|
|
4
4
|
import { itemPageMeta } from '../src/meta.ts'
|
|
5
5
|
import { FIXTURES } from './fixtures/cargo-items.ts'
|
|
6
6
|
|
|
7
7
|
test('linkToItemPage defaults to shiploadgame.com', () => {
|
|
8
|
-
const url = linkToItemPage(FIXTURES.
|
|
8
|
+
const url = linkToItemPage(FIXTURES.oreT1)
|
|
9
9
|
expect(url).toMatch(/^https:\/\/shiploadgame\.com\/guide\/item\/[A-Za-z0-9_-]+$/)
|
|
10
10
|
})
|
|
11
11
|
|
|
12
12
|
test('linkToItemPage accepts a custom base URL', () => {
|
|
13
|
-
const url = linkToItemPage(FIXTURES.
|
|
13
|
+
const url = linkToItemPage(FIXTURES.oreT1, 'http://localhost:5173')
|
|
14
14
|
expect(url.startsWith('http://localhost:5173/guide/item/')).toBe(true)
|
|
15
15
|
})
|
|
16
16
|
|
|
17
17
|
test('linkToItemImage builds a PNG URL', () => {
|
|
18
|
-
const url = linkToItemImage(FIXTURES.
|
|
18
|
+
const url = linkToItemImage(FIXTURES.oreT1, 'png')
|
|
19
19
|
expect(url).toMatch(/^https:\/\/item\.shiploadgame\.com\/item\/[A-Za-z0-9_-]+\.png$/)
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
test('linkToItemImage builds an SVG URL', () => {
|
|
23
|
-
const url = linkToItemImage(FIXTURES.
|
|
23
|
+
const url = linkToItemImage(FIXTURES.oreT1, 'svg')
|
|
24
24
|
expect(url).toMatch(/\.svg$/)
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
-
test('
|
|
28
|
-
const
|
|
27
|
+
test('linkToItemSocial builds a social card URL', () => {
|
|
28
|
+
const url = linkToItemSocial(FIXTURES.oreT1)
|
|
29
|
+
expect(url).toMatch(/^https:\/\/item\.shiploadgame\.com\/social\/[A-Za-z0-9_-]+\.png$/)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
test('itemPageMeta produces title, description, and ogImage (social card)', () => {
|
|
33
|
+
const item = FIXTURES.oreT1
|
|
29
34
|
const resolved = resolveItem(item.item_id, item.stats, item.modules)
|
|
30
35
|
const meta = itemPageMeta(item, resolved)
|
|
31
|
-
expect(meta.title).toContain('
|
|
32
|
-
expect(meta.description
|
|
33
|
-
expect(meta.
|
|
36
|
+
expect(meta.title).toContain('Crude Ore')
|
|
37
|
+
expect(meta.description).toContain('T1 Ore')
|
|
38
|
+
expect(meta.description).toMatch(/Strength \d+/)
|
|
39
|
+
expect(meta.description).toMatch(/\d+(\.\d+)? t$/)
|
|
40
|
+
expect(meta.ogImage).toMatch(/^https:\/\/item\.shiploadgame\.com\/social\/[A-Za-z0-9_-]+\.png$/)
|
|
34
41
|
expect(meta.ogImageWidth).toBe(1200)
|
|
35
42
|
expect(meta.ogImageHeight).toBe(630)
|
|
36
43
|
})
|
package/test/pixel.test.ts
CHANGED
|
@@ -25,7 +25,7 @@ async function renderPng(svg: string): Promise<Buffer> {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const CASES = [
|
|
28
|
-
{ name: 'resource-
|
|
28
|
+
{ name: 'resource-ore-t1', fixture: FIXTURES.oreT1 },
|
|
29
29
|
{ name: 'packed-entity-ship-t1-two-modules', fixture: FIXTURES.shipT1TwoModules },
|
|
30
30
|
{ name: 'packed-entity-ship-t1-only-engine', fixture: FIXTURES.shipT1OnlyEngine },
|
|
31
31
|
{ name: 'component-hull-plates', fixture: FIXTURES.hullPlates },
|
package/test/render.test.ts
CHANGED
|
@@ -6,10 +6,10 @@ import { encodePayload } from '../src/payload/codec.ts'
|
|
|
6
6
|
import { FIXTURES } from './fixtures/cargo-items.ts'
|
|
7
7
|
|
|
8
8
|
test('renderItem dispatches to resource template for resources', () => {
|
|
9
|
-
const item = FIXTURES.
|
|
9
|
+
const item = FIXTURES.oreT1
|
|
10
10
|
const resolved = resolveItem(item.item_id, item.stats, item.modules)
|
|
11
11
|
const svg = renderItem(item, resolved)
|
|
12
|
-
expect(svg).toContain('
|
|
12
|
+
expect(svg).toContain('Crude Ore')
|
|
13
13
|
})
|
|
14
14
|
|
|
15
15
|
test('renderItem dispatches to packed entity template for entities', () => {
|
|
@@ -27,14 +27,14 @@ test('renderItem dispatches to module template for modules', () => {
|
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
test('renderItem throws RenderError for unknown types', () => {
|
|
30
|
-
const item = FIXTURES.
|
|
30
|
+
const item = FIXTURES.oreT1
|
|
31
31
|
const fake = { ...resolveItem(item.item_id, item.stats, item.modules), itemType: 'unknown' as never }
|
|
32
32
|
expect(() => renderItem(item, fake)).toThrow(RenderError)
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
test('renderFromPayload round-trips a payload into SVG', async () => {
|
|
36
|
-
const payload = encodePayload(FIXTURES.
|
|
36
|
+
const payload = encodePayload(FIXTURES.oreT1)
|
|
37
37
|
const { svg, item } = await renderFromPayload(payload)
|
|
38
|
-
expect(svg).toContain('
|
|
38
|
+
expect(svg).toContain('Crude Ore')
|
|
39
39
|
expect(item.itemType).toBe('resource')
|
|
40
40
|
})
|
package/test/sdk-link.test.ts
CHANGED
|
@@ -2,18 +2,18 @@ import { expect, test } from 'bun:test'
|
|
|
2
2
|
import { resolveItem, ServerContract, type ResolvedItem } from '@shipload/sdk'
|
|
3
3
|
|
|
4
4
|
test('sdkv2 is linked and exposes resolveItem + ResolvedItem type', () => {
|
|
5
|
-
const resolved: ResolvedItem = resolveItem(
|
|
6
|
-
expect(resolved.itemId).toBe(
|
|
7
|
-
expect(resolved.
|
|
5
|
+
const resolved: ResolvedItem = resolveItem(101 /* T1 Ore */, undefined, undefined)
|
|
6
|
+
expect(resolved.itemId).toBe(101)
|
|
7
|
+
expect(resolved.category).toBe('ore')
|
|
8
8
|
expect(resolved.itemType).toBe('resource')
|
|
9
9
|
})
|
|
10
10
|
|
|
11
11
|
test('ServerContract.Types.cargo_item can be constructed', () => {
|
|
12
12
|
const ci = ServerContract.Types.cargo_item.from({
|
|
13
|
-
item_id:
|
|
13
|
+
item_id: 101,
|
|
14
14
|
quantity: 1,
|
|
15
15
|
stats: '0',
|
|
16
16
|
modules: [],
|
|
17
17
|
})
|
|
18
|
-
expect(ci.item_id.equals(
|
|
18
|
+
expect(ci.item_id.equals(101)).toBe(true)
|
|
19
19
|
})
|
|
@@ -4,7 +4,7 @@ import { renderByType } from '../src/templates/index.ts'
|
|
|
4
4
|
import { FIXTURES } from './fixtures/cargo-items.ts'
|
|
5
5
|
|
|
6
6
|
test('renderByType forwards mode=ranges to resource template', () => {
|
|
7
|
-
const item = FIXTURES.
|
|
7
|
+
const item = FIXTURES.oreT1
|
|
8
8
|
const resolved = resolveItem(item.item_id)
|
|
9
9
|
const svg = renderByType(item, resolved, { mode: 'ranges' })
|
|
10
10
|
// No 3-digit stat values
|
|
@@ -27,7 +27,7 @@ test('renderByType forwards mode=ranges to module template', () => {
|
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
test('renderByType default mode is values (no opts)', () => {
|
|
30
|
-
const item = FIXTURES.
|
|
30
|
+
const item = FIXTURES.oreT1
|
|
31
31
|
const resolved = resolveItem(item.item_id, item.stats)
|
|
32
32
|
const svg = renderByType(item, resolved)
|
|
33
33
|
// At least one numeric stat value
|
|
@@ -30,7 +30,7 @@ test('entity cell renders abbreviation', () => {
|
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
test('resource cell renders category icon (no abbreviation)', () => {
|
|
33
|
-
const resolved = resolveItem(
|
|
33
|
+
const resolved = resolveItem(101)
|
|
34
34
|
const svg = renderItemCell({ resolved, size: 48 })
|
|
35
35
|
expect(svg).not.toMatch(/>[A-Z]{2,3}</)
|
|
36
36
|
expect(svg).toMatch(/<(polygon|circle|rect)\b/)
|
|
@@ -74,7 +74,7 @@ test('abbreviation cell uses proportional font size for different sizes', () =>
|
|
|
74
74
|
})
|
|
75
75
|
|
|
76
76
|
test('resource icon renders in stroke-only mode', () => {
|
|
77
|
-
const resolved = resolveItem(
|
|
77
|
+
const resolved = resolveItem(101)
|
|
78
78
|
const svg = renderItemCell({ resolved, size: 48 })
|
|
79
79
|
expect(svg).toContain('fill="none"')
|
|
80
80
|
expect(svg).toContain('stroke-width="1.5"')
|
|
@@ -82,7 +82,7 @@ test('resource icon renders in stroke-only mode', () => {
|
|
|
82
82
|
|
|
83
83
|
test('matches golden SVG snapshot per itemType', () => {
|
|
84
84
|
const cases: [number, string][] = [
|
|
85
|
-
[
|
|
85
|
+
[101, 'item-cell-resource'],
|
|
86
86
|
[ITEM_HULL_PLATES, 'item-cell-component'],
|
|
87
87
|
[ITEM_ENGINE_T1, 'item-cell-module'],
|
|
88
88
|
[ITEM_SHIP_T1_PACKED, 'item-cell-entity'],
|
|
@@ -3,11 +3,11 @@ import { resolveItem } from '@shipload/sdk'
|
|
|
3
3
|
import { renderPackedEntity } from '../src/templates/packed-entity.ts'
|
|
4
4
|
import { FIXTURES } from './fixtures/cargo-items.ts'
|
|
5
5
|
|
|
6
|
-
test('renders Ship
|
|
6
|
+
test('renders Ship with hull attributes and two modules', () => {
|
|
7
7
|
const item = FIXTURES.shipT1TwoModules
|
|
8
8
|
const resolved = resolveItem(item.item_id, item.stats, item.modules)
|
|
9
9
|
const svg = renderPackedEntity(item, resolved)
|
|
10
|
-
expect(svg).toContain('Ship
|
|
10
|
+
expect(svg).toContain('Ship (Packed)')
|
|
11
11
|
expect(svg).toContain('HULL')
|
|
12
12
|
expect(svg).toContain('Mass')
|
|
13
13
|
expect(svg).toContain('Capacity')
|
|
@@ -3,12 +3,12 @@ import { resolveItem, getStatDefinitions } from '@shipload/sdk'
|
|
|
3
3
|
import { renderResource } from '../src/templates/resource.ts'
|
|
4
4
|
import { FIXTURES } from './fixtures/cargo-items.ts'
|
|
5
5
|
|
|
6
|
-
test('renders
|
|
7
|
-
const item = FIXTURES.
|
|
6
|
+
test('renders Crude Ore with category, mass, and three stat bars', () => {
|
|
7
|
+
const item = FIXTURES.oreT1
|
|
8
8
|
const resolved = resolveItem(item.item_id, item.stats, item.modules)
|
|
9
9
|
const svg = renderResource(item, resolved)
|
|
10
|
-
expect(svg).toContain('
|
|
11
|
-
expect(svg).toContain('
|
|
10
|
+
expect(svg).toContain('Crude Ore')
|
|
11
|
+
expect(svg).toContain('Ore') // category label
|
|
12
12
|
expect(svg).toContain('30,000') // mass
|
|
13
13
|
expect(svg).toContain('STR') // strength abbreviation
|
|
14
14
|
expect(svg).toContain('TOL')
|
|
@@ -16,35 +16,35 @@ test('renders Iron with category, mass, and three stat bars', () => {
|
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
test('renders quantity badge when stack > 1', () => {
|
|
19
|
-
const item = FIXTURES.
|
|
19
|
+
const item = FIXTURES.oreT1StackOf50
|
|
20
20
|
const resolved = resolveItem(item.item_id, item.stats, item.modules)
|
|
21
21
|
const svg = renderResource(item, resolved)
|
|
22
22
|
expect(svg).toContain('×50')
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
test('does not render quantity badge when stack == 1', () => {
|
|
26
|
-
const item = FIXTURES.
|
|
26
|
+
const item = FIXTURES.oreT1
|
|
27
27
|
const resolved = resolveItem(item.item_id, item.stats, item.modules)
|
|
28
28
|
const svg = renderResource(item, resolved)
|
|
29
29
|
expect(svg).not.toContain('×')
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
test('matches the committed
|
|
33
|
-
const item = FIXTURES.
|
|
32
|
+
test('matches the committed Crude Ore snapshot', async () => {
|
|
33
|
+
const item = FIXTURES.oreT1
|
|
34
34
|
const resolved = resolveItem(item.item_id, item.stats, item.modules)
|
|
35
35
|
const svg = renderResource(item, resolved)
|
|
36
|
-
expect(svg).toMatchSnapshot('resource-
|
|
36
|
+
expect(svg).toMatchSnapshot('resource-ore-t1.svg')
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
-
test('matches the committed
|
|
40
|
-
const item = FIXTURES.
|
|
39
|
+
test('matches the committed Dense Gas snapshot', async () => {
|
|
40
|
+
const item = FIXTURES.gasT2
|
|
41
41
|
const resolved = resolveItem(item.item_id, item.stats, item.modules)
|
|
42
42
|
const svg = renderResource(item, resolved)
|
|
43
|
-
expect(svg).toMatchSnapshot('resource-
|
|
43
|
+
expect(svg).toMatchSnapshot('resource-gas-t2.svg')
|
|
44
44
|
})
|
|
45
45
|
|
|
46
46
|
test('renderResource ranges mode shows stat abbreviations with no values', () => {
|
|
47
|
-
const item = FIXTURES.
|
|
47
|
+
const item = FIXTURES.oreT1
|
|
48
48
|
const resolved = resolveItem(item.item_id)
|
|
49
49
|
const svg = renderResource(item, resolved, { mode: 'ranges' })
|
|
50
50
|
const defs = getStatDefinitions(resolved.category!)
|
|
@@ -57,14 +57,14 @@ test('renderResource ranges mode shows stat abbreviations with no values', () =>
|
|
|
57
57
|
})
|
|
58
58
|
|
|
59
59
|
test('renderResource values mode (default) still shows concrete numbers', () => {
|
|
60
|
-
const item = FIXTURES.
|
|
60
|
+
const item = FIXTURES.oreT1
|
|
61
61
|
const resolved = resolveItem(item.item_id, item.stats)
|
|
62
62
|
const svg = renderResource(item, resolved)
|
|
63
63
|
expect(svg).toMatch(/>\d+<\/text>/)
|
|
64
64
|
})
|
|
65
65
|
|
|
66
66
|
test('renderResource ranges mode matches snapshot', () => {
|
|
67
|
-
const item = FIXTURES.
|
|
67
|
+
const item = FIXTURES.oreT1
|
|
68
68
|
const resolved = resolveItem(item.item_id)
|
|
69
69
|
const svg = renderResource(item, resolved, { mode: 'ranges' })
|
|
70
70
|
expect(svg).toMatchSnapshot('resource-ranges')
|
package/test/tokens.test.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { tierColors as sdkTierColors } from '@shipload/sdk'
|
|
|
3
3
|
import { tokens } from '../src/tokens/index.ts'
|
|
4
4
|
|
|
5
5
|
test('colors include all resource categories', () => {
|
|
6
|
-
for (const cat of ['
|
|
6
|
+
for (const cat of ['ore', 'crystal', 'gas', 'regolith', 'biomass']) {
|
|
7
7
|
expect(tokens.colors.category).toHaveProperty(cat)
|
|
8
8
|
expect(tokens.colors.category[cat as keyof typeof tokens.colors.category]).toMatch(/^#[0-9a-f]{6}$/i)
|
|
9
9
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|