Skip to content

Commit 8e81984

Browse files
committed
Add generic asset contract tests for GameFoundryStudio - PR_26152_071-asset-contract-tests
1 parent 8ee603c commit 8e81984

4 files changed

Lines changed: 1690 additions & 0 deletions

File tree

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Asset Contract Tests Validation
2+
3+
PR: PR_26152_071-asset-contract-tests
4+
Date: 2026-06-02
5+
6+
## Scope
7+
8+
- Added reusable generic Asset contract data under `src/shared/contracts/assetContract.js`.
9+
- Added Asset fixtures under `tests/fixtures/assets/asset-scenarios.json`.
10+
- Added targeted contract tests under `tests/shared/AssetContract.test.mjs`.
11+
- No database implementation was added.
12+
- No authentication implementation was added.
13+
- No UI/page/runtime behavior was changed.
14+
- No CSS or HTML files were changed.
15+
- No dependencies were added.
16+
17+
## Contract Coverage
18+
19+
Targeted tests prove:
20+
21+
- asset records require owner
22+
- asset records require project
23+
- asset type must be valid
24+
- asset records may link to source tool state
25+
- visibility rules are enforced
26+
- exported assets remain portable
27+
- archived assets are immutable unless policy allows edits
28+
- version must be valid
29+
- asset metadata must be valid for the asset type
30+
31+
The generic Asset contract defines:
32+
33+
- `assetId`
34+
- `assetType`
35+
- `ownerId`
36+
- `projectId`
37+
- `sourceToolState`
38+
- `visibility`
39+
- `version`
40+
- `status`
41+
- `metadata`
42+
- `exportFormats`
43+
44+
Supported first-pass asset types:
45+
46+
- `vector`
47+
- `palette`
48+
- `image`
49+
- `audio`
50+
- `tilemap`
51+
- `localization`
52+
53+
## Validation Lanes
54+
55+
- lanes executed: contract - Asset contract tests plus existing Palette, Vector Asset, Tool State, Project, and Identity/Permissions contract tests were required by the PR.
56+
- lanes skipped: runtime, integration, engine, recovery/UAT - no runtime, handoff, engine, or recovery behavior changed.
57+
- samples decision: SKIP because samples were explicitly out of scope and no sample contracts or runtime paths changed.
58+
- Playwright impacted: No. This PR changes contract data and targeted Node tests only.
59+
- blocker scope: targeted contract lane only.
60+
61+
## Commands
62+
63+
```powershell
64+
node ./scripts/run-node-test-files.mjs tests/shared/AssetContract.test.mjs tests/shared/PaletteContract.test.mjs tests/shared/VectorAssetContract.test.mjs tests/shared/ToolStateContract.test.mjs tests/shared/ProjectContract.test.mjs tests/shared/IdentityPermissionsContract.test.mjs
65+
```
66+
67+
Result: PASS
68+
69+
```text
70+
PASS tests/shared/AssetContract.test.mjs
71+
PASS tests/shared/PaletteContract.test.mjs
72+
PASS tests/shared/VectorAssetContract.test.mjs
73+
PASS tests/shared/ToolStateContract.test.mjs
74+
PASS tests/shared/ProjectContract.test.mjs
75+
PASS tests/shared/IdentityPermissionsContract.test.mjs
76+
77+
6/6 targeted node test file(s) passed.
78+
```
79+
80+
```powershell
81+
git diff --check -- src/shared/contracts/assetContract.js tests/shared/AssetContract.test.mjs tests/fixtures/assets/asset-scenarios.json
82+
```
83+
84+
Result: PASS with no output.
85+
86+
## Expected PASS Behavior
87+
88+
- Valid asset fixtures pass without errors across vector, palette, image, audio, tilemap, and localization types.
89+
- Invalid asset fixtures return the exact expected contract error codes.
90+
- Owner/project/type/visibility/version/export format requirements are enforced.
91+
- Source tool state links are allowed when they identify tool state, tool type, and matching project.
92+
- Type-specific metadata is enforced for vector, palette, image, audio, tilemap, and localization assets.
93+
- File-like metadata uses `filePath`; no database, runtime, or data URL persistence was introduced.
94+
- Private assets deny ungranted viewers and allow granted project viewers.
95+
- Collaborators can edit granted active project assets.
96+
- Viewers cannot edit assets.
97+
- Marketplace assets are visible.
98+
- Archived assets reject edits unless policy explicitly allows archived edits.
99+
- Portable asset exports preserve portable fields and remove owner/project/database identifiers.
100+
101+
## Expected WARN Behavior
102+
103+
- No WARN findings for the targeted contract lane.
104+
- Repo-wide, samples, UI, CSS, HTML, database, and authentication validation were intentionally not run because they are outside this PR scope.

0 commit comments

Comments
 (0)