@@ -28,6 +28,7 @@ describe("LetterVariant Events", () => {
2828 description : "A standard letter variant for general correspondence" ,
2929 volumeGroupId : "supplier-framework-123" ,
3030 type : "STANDARD" ,
31+ priority : 10 ,
3132 status : "PROD" ,
3233 packSpecificationIds : [ "bau-standard-c5" , "bau-standard-c4" ] ,
3334 } ,
@@ -68,6 +69,7 @@ describe("LetterVariant Events", () => {
6869 name : "Braille Letter Variant" ,
6970 volumeGroupId : "supplier-framework-123" ,
7071 type : "BRAILLE" ,
72+ priority : 20 ,
7173 status : "PROD" ,
7274 packSpecificationIds : [ "braille" ] ,
7375 } ,
@@ -85,6 +87,7 @@ describe("LetterVariant Events", () => {
8587 name : "Audio Letter Variant" ,
8688 volumeGroupId : "supplier-framework-123" ,
8789 type : "AUDIO" ,
90+ priority : 30 ,
8891 status : "PROD" ,
8992 packSpecificationIds : [ "audio" ] ,
9093 } ,
@@ -173,6 +176,32 @@ describe("LetterVariant Events", () => {
173176 expect ( result . success ) . toBe ( false ) ;
174177 } ) ;
175178
179+ it ( "should reject event with non-integer priority" , ( ) => {
180+ const invalidEvent = {
181+ ...validProdEvent ,
182+ data : {
183+ ...validProdEvent . data ,
184+ priority : 1.5 ,
185+ } ,
186+ } ;
187+
188+ const result = $LetterVariantEvent . safeParse ( invalidEvent ) ;
189+ expect ( result . success ) . toBe ( false ) ;
190+ } ) ;
191+
192+ it ( "should default priority to 50 when omitted" , ( ) => {
193+ const { priority, ...dataWithoutPriority } = validProdEvent . data ;
194+ expect ( priority ) . toBe ( 10 ) ;
195+ const eventWithoutPriority = {
196+ ...validProdEvent ,
197+ data : dataWithoutPriority ,
198+ } ;
199+
200+ const result = $LetterVariantEvent . safeParse ( eventWithoutPriority ) ;
201+ expect ( result . success ) . toBe ( true ) ;
202+ expect ( result . data ?. data . priority ) . toBe ( 50 ) ;
203+ } ) ;
204+
176205 it ( "should validate specialised schema enforces PROD status" , ( ) => {
177206 const prodSchema = letterVariantEvents [ "letter-variant.prod" ] ;
178207
@@ -290,6 +319,7 @@ describe("LetterVariant Events", () => {
290319 name : "Disabled Letter Variant" ,
291320 volumeGroupId : "supplier-framework-123" ,
292321 type : "STANDARD" ,
322+ priority : 15 ,
293323 status : "INT" ,
294324 packSpecificationIds : [ "bau-standard-c5" ] ,
295325 } ,
@@ -350,6 +380,7 @@ describe("LetterVariant Events", () => {
350380 description : "A letter variant that has been disabled" ,
351381 volumeGroupId : "supplier-framework-123" ,
352382 type : "STANDARD" ,
383+ priority : 15 ,
353384 status : "DISABLED" ,
354385 packSpecificationIds : [ "bau-standard-c5" ] ,
355386 } ,
0 commit comments