@@ -792,21 +792,24 @@ describe("<shopify-checkout>", () => {
792792 ) ;
793793 } ) ;
794794
795- it ( "ignores unsupported notifications" , ( ) => {
796- const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
795+ it . each ( [ "customMethod" , "ec.buyer.change" ] ) (
796+ "ignores unsupported notification %s" ,
797+ ( method ) => {
798+ const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
797799
798- simulateRawMessageEvent (
799- checkout ,
800- {
801- jsonrpc : "2.0" ,
802- method : "customMethod" ,
803- params : { } ,
804- } ,
805- { source : mockCheckoutWindow } ,
806- ) ;
800+ simulateRawMessageEvent (
801+ checkout ,
802+ {
803+ jsonrpc : "2.0" ,
804+ method ,
805+ params : { } ,
806+ } ,
807+ { source : mockCheckoutWindow } ,
808+ ) ;
807809
808- expect ( mockCheckoutWindow . postMessage ) . not . toHaveBeenCalled ( ) ;
809- } ) ;
810+ expect ( mockCheckoutWindow . postMessage ) . not . toHaveBeenCalled ( ) ;
811+ } ,
812+ ) ;
810813 } ) ;
811814
812815 describe ( "checkout:start" , ( ) => {
@@ -942,23 +945,6 @@ describe("<shopify-checkout>", () => {
942945 } ) ;
943946 } ) ;
944947
945- describe ( "checkout:buyerChange" , ( ) => {
946- it ( "updates the checkout property and dispatches an ec:buyerChange event" , async ( ) => {
947- const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
948- const onBuyerChangeSpy = vi . fn ( ) ;
949- const listenForEvent = waitForEvent ( checkout , "checkout:buyerChange" , onBuyerChangeSpy ) ;
950-
951- const payload = makeCheckoutPayload ( ) ;
952- simulateProtocolMessageEvent ( checkout , "ec.buyer.change" , payload , {
953- source : mockCheckoutWindow ,
954- } ) ;
955- await listenForEvent ;
956-
957- expect ( checkout . checkout ) . toBe ( payload . checkout ) ;
958- expect ( onBuyerChangeSpy ) . toHaveBeenCalledOnce ( ) ;
959- } ) ;
960- } ) ;
961-
962948 describe ( "checkout:totalsChange" , ( ) => {
963949 it ( "updates the checkout property and dispatches an ec:totalsChange event" , async ( ) => {
964950 const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
@@ -1063,22 +1049,6 @@ describe("<shopify-checkout>", () => {
10631049 expect ( event . detail . checkout ) . toBe ( payload . checkout ) ;
10641050 } ) ;
10651051
1066- it ( "checkout:buyerChange carries {buyer, checkout}" , async ( ) => {
1067- const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
1068- const spy = vi . fn ( ) ;
1069- const wait = waitForEvent ( checkout , "checkout:buyerChange" , spy ) ;
1070-
1071- const payload = makeCheckoutPayload ( ) ;
1072- simulateProtocolMessageEvent ( checkout , "ec.buyer.change" , payload , {
1073- source : mockCheckoutWindow ,
1074- } ) ;
1075- await wait ;
1076-
1077- const event = spy . mock . calls [ 0 ] ! [ 0 ] as CustomEvent ;
1078- expect ( event . detail . buyer ) . toBe ( payload . checkout . buyer ) ;
1079- expect ( event . detail . checkout ) . toBe ( payload . checkout ) ;
1080- } ) ;
1081-
10821052 it ( "checkout:totalsChange carries {totals, checkout}" , async ( ) => {
10831053 const { checkout, mockCheckoutWindow } = openPopupCheckout ( ) ;
10841054 const spy = vi . fn ( ) ;
0 commit comments