@@ -3,9 +3,10 @@ import { EventPublisher, Logger } from 'utils';
33import { mock } from 'jest-mock-extended' ;
44import { createHandler } from 'apis/dynamodb-stream-handler' ;
55import { Dlq } from 'app/dlq' ;
6+ import { ItemDequeued } from 'digital-letters-events' ;
67
78const logger = mock < Logger > ( ) ;
8- const eventPublisher = mock < EventPublisher > ( ) ;
9+ const eventPublisher = mock < EventPublisher < ItemDequeued > > ( ) ;
910const dlq = mock < Dlq > ( ) ;
1011const futureTimestamp = Date . now ( ) + 1_000_000 ;
1112
@@ -29,12 +30,10 @@ const mockEvent: DynamoDBStreamEvent = {
2930 dateOfExpiry : { S : 'dateOfExpiry' } ,
3031 event : {
3132 M : {
32- profileversion : { S : '1.0.0' } ,
33- profilepublished : { S : '2025-10' } ,
3433 id : { S : '550e8400-e29b-41d4-a716-446655440001' } ,
3534 specversion : { S : '1.0' } ,
3635 source : {
37- S : '/nhs/england/notify/production/primary/data-plane/digital-letters ' ,
36+ S : '/nhs/england/notify/production/primary/data-plane/digitalletters/mesh ' ,
3837 } ,
3938 subject : {
4039 S : 'customer/920fca11-596a-4eca-9c47-99f624614658/recipient/769acdd4-6a47-496f-999f-76a6fd2c3959' ,
@@ -50,16 +49,12 @@ const mockEvent: DynamoDBStreamEvent = {
5049 } ,
5150 datacontenttype : { S : 'application/json' } ,
5251 dataschema : {
53- S : 'https://notify.nhs.uk/cloudevents/schemas/digital-letters/2025-10/ digital-letter-base -data.schema.json' ,
52+ S : 'https://notify.nhs.uk/cloudevents/schemas/digital-letters/2025-10-draft/data/ digital-letters-mesh-inbox-message-downloaded -data.schema.json' ,
5453 } ,
55- dataschemaversion : { S : '1.0' } ,
5654 severitytext : { S : 'INFO' } ,
5755 data : {
5856 M : {
5957 messageUri : { S : 'https://example.com/ttl/resource' } ,
60- 'digital-letter-id' : {
61- S : '123e4567-e89b-12d3-a456-426614174000' ,
62- } ,
6358 messageReference : { S : 'ref1' } ,
6459 senderId : { S : 'sender1' } ,
6560 } ,
@@ -110,21 +105,16 @@ describe('createHandler', () => {
110105
111106 expect ( eventPublisher . sendEvents ) . toHaveBeenCalledWith ( [
112107 expect . objectContaining ( {
113- profileversion : '1.0.0' ,
114- profilepublished : '2025-10' ,
115108 specversion : '1.0' ,
116109 source :
117- '/nhs/england/notify/production/primary/data-plane/digital-letters ' ,
110+ '/nhs/england/notify/production/primary/data-plane/digitalletters/mesh ' ,
118111 subject :
119112 'customer/920fca11-596a-4eca-9c47-99f624614658/recipient/769acdd4-6a47-496f-999f-76a6fd2c3959' ,
120113 type : 'uk.nhs.notify.digital.letters.queue.item.dequeued.v1' ,
121114 datacontenttype : 'application/json' ,
122115 dataschema :
123- 'https://notify.nhs.uk/cloudevents/schemas/digital-letters/2025-10/ digital-letter-base -data.schema.json' ,
116+ 'https://notify.nhs.uk/cloudevents/schemas/digital-letters/2025-10-draft/data/ digital-letters-queue-item-dequeued -data.schema.json' ,
124117 data : expect . objectContaining ( {
125- 'digital-letter-id' : expect . stringMatching (
126- / ^ [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 12 } $ / i,
127- ) ,
128118 messageReference : 'ref1' ,
129119 messageUri : 'https://example.com/ttl/resource' ,
130120 senderId : 'sender1' ,
0 commit comments