@@ -821,21 +821,24 @@ describe("<shopify-checkout>", () => {
821821 expect ( mockCheckoutWindow . postMessage ) . not . toHaveBeenCalled ( ) ;
822822 } ) ;
823823
824- it ( "ignores unsupported notifications" , ( ) => {
825- const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
824+ it . each ( [ "customMethod" , "ec.buyer.change" ] ) (
825+ "ignores unsupported notification %s" ,
826+ ( method ) => {
827+ const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
826828
827- simulateRawMessageEvent (
828- checkout ,
829- {
830- jsonrpc : "2.0" ,
831- method : "customMethod" ,
832- params : { } ,
833- } ,
834- { source : mockCheckoutWindow } ,
835- ) ;
829+ simulateRawMessageEvent (
830+ checkout ,
831+ {
832+ jsonrpc : "2.0" ,
833+ method ,
834+ params : { } ,
835+ } ,
836+ { source : mockCheckoutWindow } ,
837+ ) ;
836838
837- expect ( mockCheckoutWindow . postMessage ) . not . toHaveBeenCalled ( ) ;
838- } ) ;
839+ expect ( mockCheckoutWindow . postMessage ) . not . toHaveBeenCalled ( ) ;
840+ } ,
841+ ) ;
839842 } ) ;
840843
841844 describe ( "checkout:start" , ( ) => {
@@ -971,23 +974,6 @@ describe("<shopify-checkout>", () => {
971974 } ) ;
972975 } ) ;
973976
974- describe ( "checkout:buyerChange" , ( ) => {
975- it ( "updates the checkout property and dispatches an ec:buyerChange event" , async ( ) => {
976- const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
977- const onBuyerChangeSpy = vi . fn ( ) ;
978- const listenForEvent = waitForEvent ( checkout , "checkout:buyerChange" , onBuyerChangeSpy ) ;
979-
980- const payload = makeCheckoutPayload ( ) ;
981- simulateProtocolMessageEvent ( checkout , "ec.buyer.change" , payload , {
982- source : mockCheckoutWindow ,
983- } ) ;
984- await listenForEvent ;
985-
986- expect ( checkout . checkout ) . toBe ( payload . checkout ) ;
987- expect ( onBuyerChangeSpy ) . toHaveBeenCalledOnce ( ) ;
988- } ) ;
989- } ) ;
990-
991977 describe ( "checkout:totalsChange" , ( ) => {
992978 it ( "updates the checkout property and dispatches an ec:totalsChange event" , async ( ) => {
993979 const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
@@ -1092,22 +1078,6 @@ describe("<shopify-checkout>", () => {
10921078 expect ( event . detail . checkout ) . toBe ( payload . checkout ) ;
10931079 } ) ;
10941080
1095- it ( "checkout:buyerChange carries {buyer, checkout}" , async ( ) => {
1096- const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
1097- const spy = vi . fn ( ) ;
1098- const wait = waitForEvent ( checkout , "checkout:buyerChange" , spy ) ;
1099-
1100- const payload = makeCheckoutPayload ( ) ;
1101- simulateProtocolMessageEvent ( checkout , "ec.buyer.change" , payload , {
1102- source : mockCheckoutWindow ,
1103- } ) ;
1104- await wait ;
1105-
1106- const event = spy . mock . calls [ 0 ] ! [ 0 ] as CustomEvent ;
1107- expect ( event . detail . buyer ) . toBe ( payload . checkout . buyer ) ;
1108- expect ( event . detail . checkout ) . toBe ( payload . checkout ) ;
1109- } ) ;
1110-
11111081 it ( "checkout:totalsChange carries {totals, checkout}" , async ( ) => {
11121082 const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
11131083 const spy = vi . fn ( ) ;
0 commit comments