@@ -63,6 +63,16 @@ let purchaseItIdNoFeedback: string;
6363let purchaseItNotRefundedId : string ;
6464let purchaseIdWithScreenshot : string ;
6565let purchaseIdForUpdate : string ;
66+
67+ // Generate a fake Amazon order ID
68+ // Amazon order IDs typically look like "123-1234567-1234567"
69+ const generateFakeAmazonOrderId = ( ) => {
70+ const part1 = Math . floor ( Math . random ( ) * 1000 ) ;
71+ const part2 = Math . floor ( Math . random ( ) * 10000000 ) ;
72+ const part3 = Math . floor ( Math . random ( ) * 10000000 ) ;
73+ return `${ part1 } -${ part2 } -${ part3 } ` ;
74+ } ;
75+
6676// HTTP client with authorization
6777const api = {
6878 post : async ( path : string , data : any ) => {
@@ -212,7 +222,7 @@ describe('Feedback Flow API', () => {
212222 test ( '70. Should create a purchase' , async ( ) => {
213223 const purchase : Purchase = {
214224 date : new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] , // Today in YYYY-MM-DD format
215- order : `ORDER- ${ uuidv4 ( ) . substring ( 0 , 8 ) } ` ,
225+ order : generateFakeAmazonOrderId ( ) ,
216226 description : 'Test product purchase' ,
217227 amount : 29.99 ,
218228 screenshot : testImageBase64
@@ -327,7 +337,7 @@ describe('Feedback Flow API', () => {
327337 test ( '150. Should create a non-refunded purchase' , async ( ) => {
328338 const purchase : Purchase = {
329339 date : new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] , // Today in YYYY-MM-DD format
330- order : `ORDER- ${ uuidv4 ( ) . substring ( 0 , 8 ) } ` ,
340+ order : generateFakeAmazonOrderId ( ) ,
331341 description : 'Test product purchase not refunded' ,
332342 amount : 49.99 ,
333343 screenshot : testImageBase64
@@ -358,7 +368,7 @@ describe('Feedback Flow API', () => {
358368 test ( '170. Should create a non-refunded purchase with no feedback' , async ( ) => {
359369 const purchase : Purchase = {
360370 date : new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] , // Today in YYYY-MM-DD format
361- order : `ORDER- ${ uuidv4 ( ) . substring ( 0 , 8 ) } ` ,
371+ order : generateFakeAmazonOrderId ( ) ,
362372 description : 'Test product purchase no feedback' ,
363373 amount : 69.99 ,
364374 screenshot : testImageBase64
@@ -373,7 +383,7 @@ describe('Feedback Flow API', () => {
373383 test ( '180. Should create a purchase and add feedback but not publish it' , async ( ) => {
374384 const purchase : Purchase = {
375385 date : new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] , // Today in YYYY-MM-DD format
376- order : `ORDER- ${ uuidv4 ( ) . substring ( 0 , 8 ) } ` ,
386+ order : generateFakeAmazonOrderId ( ) ,
377387 description : 'Test product purchase not published' ,
378388 amount : 89.99 ,
379389 screenshot : testImageBase64
@@ -401,7 +411,7 @@ describe('Feedback Flow API', () => {
401411 test ( '190. Should create a purchase, add feedback to it, publish the feedback but do not refund the purchase' , async ( ) => {
402412 const purchase : Purchase = {
403413 date : new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] , // Today in YYYY-MM-DD format
404- order : `ORDER- ${ uuidv4 ( ) . substring ( 0 , 8 ) } ` ,
414+ order : generateFakeAmazonOrderId ( ) ,
405415 description : 'Test product purchase with feedback and publication' ,
406416 amount : 69.99 ,
407417 screenshot : testImageBase64
@@ -522,7 +532,7 @@ describe('Feedback Flow API', () => {
522532 test ( '220. Create a purchase with a screenshot' , async ( ) => {
523533 const purchase : Purchase = {
524534 date : new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] , // Today in YYYY-MM-DD format
525- order : `ORDER- ${ uuidv4 ( ) . substring ( 0 , 8 ) } ` ,
535+ order : generateFakeAmazonOrderId ( ) ,
526536 description : 'Test product purchase with screenshot' ,
527537 amount : 99.99 ,
528538 screenshot : testImageBase64
@@ -575,7 +585,7 @@ describe('Feedback Flow API', () => {
575585 test ( '260. Should create a purchase for update testing' , async ( ) => {
576586 const purchase : Purchase = {
577587 date : new Date ( ) . toISOString ( ) . split ( 'T' ) [ 0 ] , // Today in YYYY-MM-DD format
578- order : `ORDER- ${ uuidv4 ( ) . substring ( 0 , 8 ) } ` ,
588+ order : generateFakeAmazonOrderId ( ) ,
579589 description : 'Test product purchase for update' ,
580590 amount : 99.99 ,
581591 screenshot : testImageBase64
@@ -705,7 +715,7 @@ describe('Feedback Flow API', () => {
705715 // Create a new purchase for this test to avoid rate limiting issues
706716 const purchase : Purchase = {
707717 date : '2024-01-01' ,
708- order : `ORDER- ${ uuidv4 ( ) . substring ( 0 , 8 ) } ` ,
718+ order : generateFakeAmazonOrderId ( ) ,
709719 description : 'Test product for date update' ,
710720 amount : 49.99 ,
711721 screenshot : testImageBase64
0 commit comments