import{newSpecPage}from"@stencil/core/testing";import{ScCustomerLastname}from"../sc-customer-lastname";import{dispose as disposeCheckout,state as checkoutState}from"../../../../../store/checkout/index";import{dispose as disposeUser,state as userState}from"../../../../../store/user/index";describe("sc-customer-lastname",(()=>{beforeEach((()=>{disposeCheckout(),disposeUser()}));const t=[{testLabel:"Customer and Checkout last name provided",checkout:{last_name:"CheckoutLast",customer:{last_name:"CustomerLast"}}},{testLabel:"Customer last name provided",checkout:{customer:{last_name:"CustomerLast"}}},{testLabel:"Checkout last name provided",checkout:{last_name:"CheckoutLast"}}];function e(t){global.window=Object.create(window),Object.defineProperty(window,"location",{value:{search:t?new URLSearchParams("?last_name=UrlLast").toString():""},writable:!0})}describe.each(t)("Logged In",(t=>{it(`${t.testLabel} with URL Params`,(async()=>{e(!0),userState.loggedIn=!0,checkoutState.checkout=t.checkout;const a=await newSpecPage({components:[ScCustomerLastname],html:"<sc-customer-lastname></sc-customer-lastname>"});expect(a.root).toMatchSnapshot(),a.rootInstance.disconnectedCallback()})),it(`${t.testLabel} without URL Params`,(async()=>{e(!1),userState.loggedIn=!0,checkoutState.checkout=t.checkout;const a=await newSpecPage({components:[ScCustomerLastname],html:"<sc-customer-lastname></sc-customer-lastname>"});expect(a.root).toMatchSnapshot(),a.rootInstance.disconnectedCallback()}))})),describe.each(t)("Logged Out",(t=>{it(`${t.testLabel} with URL Params`,(async()=>{e(!0),userState.loggedIn=!1,checkoutState.checkout=t.checkout;const a=await newSpecPage({components:[ScCustomerLastname],html:"<sc-customer-lastname></sc-customer-lastname>"});expect(a.root).toMatchSnapshot(),a.rootInstance.disconnectedCallback()})),it(`${t.testLabel} without URL Params`,(async()=>{e(!1),userState.loggedIn=!1,checkoutState.checkout=t.checkout;const a=await newSpecPage({components:[ScCustomerLastname],html:"<sc-customer-lastname></sc-customer-lastname>"});expect(a.root).toMatchSnapshot(),a.rootInstance.disconnectedCallback()}))}))}));