@@ -39,7 +39,7 @@ describe('Export Job Lifecycle (Integration)', () => {
3939 const store = await db . store . create ( {
4040 data : {
4141 name : 'Test Store' ,
42- domain : 'test-store.example.com ' ,
42+ slug : 'test-store' ,
4343 currency : 'USD' ,
4444 timezone : 'America/New_York' ,
4545 } ,
@@ -52,38 +52,56 @@ describe('Export Job Lifecycle (Integration)', () => {
5252 email : 'test@example.com' ,
5353 name : 'Test User' ,
5454 password : 'hashed_password' ,
55- role : 'StoreAdmin ' ,
55+ role : 'STORE_ADMIN ' ,
5656 } ,
5757 } ) ;
5858 userId = user . id ;
5959
6060 // Create test orders
6161 for ( let i = 0 ; i < 5 ; i ++ ) {
62+ // Create addresses for the order
63+ const shippingAddr = await db . address . create ( {
64+ data : {
65+ firstName : 'John' ,
66+ lastName : 'Doe' ,
67+ address1 : '123 Main St' ,
68+ city : 'New York' ,
69+ state : 'NY' ,
70+ zip : '10001' ,
71+ country : 'US' ,
72+ storeId,
73+ } ,
74+ } ) ;
75+
76+ const billingAddr = await db . address . create ( {
77+ data : {
78+ firstName : 'John' ,
79+ lastName : 'Doe' ,
80+ address1 : '123 Main St' ,
81+ city : 'New York' ,
82+ state : 'NY' ,
83+ zip : '10001' ,
84+ country : 'US' ,
85+ storeId,
86+ } ,
87+ } ) ;
88+
6289 await db . order . create ( {
6390 data : {
6491 storeId,
6592 userId,
6693 orderNumber : `ORD-${ 1000 + i } ` ,
6794 status : 'DELIVERED' ,
68- total : 100 + i * 10 ,
69- shippingAddress : JSON . stringify ( {
70- firstName : 'John' ,
71- lastName : 'Doe' ,
72- address : '123 Main St' ,
73- city : 'New York' ,
74- state : 'NY' ,
75- zip : '10001' ,
76- country : 'US' ,
77- } ) ,
78- billingAddress : JSON . stringify ( {
79- firstName : 'John' ,
80- lastName : 'Doe' ,
81- address : '123 Main St' ,
82- city : 'New York' ,
83- state : 'NY' ,
84- zip : '10001' ,
85- country : 'US' ,
86- } ) ,
95+ subtotal : 100 + i * 10 ,
96+ tax : 0 ,
97+ shippingCost : 0 ,
98+ discount : 0 ,
99+ shippingAddress : {
100+ connect : { id : shippingAddr . id } ,
101+ } ,
102+ billingAddress : {
103+ connect : { id : billingAddr . id } ,
104+ } ,
87105 } ,
88106 } ) ;
89107 }
@@ -268,6 +286,10 @@ describe('Export Job Lifecycle (Integration)', () => {
268286 . mockRejectedValueOnce ( new Error ( 'Transient error' ) )
269287 . mockResolvedValueOnce ( {
270288 url : 'https://blob.vercel-storage.com/test-export.csv' ,
289+ downloadUrl : 'https://blob.vercel-storage.com/test-export.csv' ,
290+ pathname : 'test-export.csv' ,
291+ contentType : 'text/csv' ,
292+ contentDisposition : 'attachment; filename="test-export.csv"' ,
271293 } ) ;
272294
273295 const { jobId } = await enqueueOrderExport ( storeId , userId , { } , 5 ) ;
0 commit comments