@carrot-foundation/schemas 0.1.28 โ†’ 0.1.30

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/README.md CHANGED
@@ -118,6 +118,39 @@ const massIdData: MassIDData = {
118
118
  };
119
119
  ```
120
120
 
121
+ ## ๐Ÿงช Testing
122
+
123
+ This repository uses [Vitest](https://vitest.dev/) for automated testing. Tests validate that schemas correctly validate example data and reject invalid inputs.
124
+
125
+ ### Running Tests
126
+
127
+ ```bash
128
+ # Run all tests once
129
+ pnpm test
130
+
131
+ # Run tests in watch mode
132
+ pnpm test:watch
133
+
134
+ # Run tests with coverage report
135
+ pnpm test:coverage
136
+
137
+ # Open Vitest UI for interactive testing
138
+ pnpm test:ui
139
+ ```
140
+
141
+ ### Test Structure
142
+
143
+ Tests are located alongside their schemas in `src/**/*.spec.ts` files. Each test file validates:
144
+
145
+ - Example JSON files pass schema validation
146
+ - Invalid data is properly rejected
147
+ - Type inference works correctly
148
+ - Edge cases are handled appropriately
149
+
150
+ ### Coverage
151
+
152
+ Coverage thresholds are set at **100%** for branches, functions, lines, and statements.
153
+
121
154
  ## โœ… Usage
122
155
 
123
156
  You may:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-foundation/schemas",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "Carrot schema definitions and zod validation schemas",
5
5
  "license": "Apache-2.0",
6
6
  "private": false,
@@ -53,10 +53,13 @@
53
53
  "@eslint/js": "9.39.1",
54
54
  "@tsconfig/recommended": "1.0.13",
55
55
  "@types/node": "24.10.1",
56
+ "@vitest/coverage-v8": "4.0.15",
57
+ "@vitest/ui": "4.0.15",
56
58
  "ajv": "8.17.1",
57
59
  "ajv-formats": "3.0.1",
58
60
  "cspell": "9.4.0",
59
61
  "eslint": "9.39.1",
62
+ "eslint-plugin-vitest-globals": "1.5.0",
60
63
  "glob": "13.0.0",
61
64
  "globals": "16.5.0",
62
65
  "husky": "9.1.7",
@@ -67,7 +70,8 @@
67
70
  "prettier": "3.7.4",
68
71
  "tsup": "8.5.1",
69
72
  "typescript": "5.9.3",
70
- "typescript-eslint": "8.48.1"
73
+ "typescript-eslint": "8.48.1",
74
+ "vitest": "4.0.15"
71
75
  },
72
76
  "publishConfig": {
73
77
  "access": "public"
@@ -86,6 +90,10 @@
86
90
  "pregenerate-ipfs-schemas": "pnpm build",
87
91
  "preinstall": "npx only-allow pnpm",
88
92
  "spell-check": "cspell lint --no-must-find-files \"src/**/*\"",
93
+ "test": "vitest run",
94
+ "test:coverage": "vitest run --coverage",
95
+ "test:ui": "vitest --ui",
96
+ "test:watch": "vitest",
89
97
  "type-check": "tsc --noEmit",
90
98
  "validate-schemas": "node scripts/validate-schemas.js",
91
99
  "verify-schema-versions": "node scripts/verify-schema-versions.js"
@@ -320,8 +320,8 @@
320
320
  "event_name": "Recycling",
321
321
  "description": "Composting process completed",
322
322
  "timestamp": 1740213312000,
323
- "participant_id_hash": "c3d4e5f67890123456789012345678901234567890abcdef1234567890abcdef",
324
- "location_id_hash": "b2c3d4e5f67890123456789012345678901234567890abcdef1234567890cdef"
323
+ "participant_id_hash": "b2c3d4e5f6789012345678901234567890abcdefabcdefabcdefabcdefabcdef",
324
+ "location_id_hash": "6e83b8e6373847bbdc056549bedda38dc88854ce41ba4fca11e0fc6ce3e07ef6"
325
325
  }
326
326
  ],
327
327
  "total_duration_minutes": 4350
@@ -2,8 +2,8 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "title": "MassID NFT IPFS Record",
4
4
  "description": "Complete MassID NFT IPFS record including fixed attributes and detailed waste tracking data",
5
- "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.1.28/schemas/ipfs/mass-id/mass-id.schema.json",
6
- "version": "0.1.28",
5
+ "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.1.30/schemas/ipfs/mass-id/mass-id.schema.json",
6
+ "version": "0.1.30",
7
7
  "type": "object",
8
8
  "properties": {
9
9
  "$schema": {