import{newSpecPage}from"@stencil/core/testing";import{dispose as disposeCheckout,state as checkoutState}from"../../../../../store/checkout/index";import{dispose as disposeUser,state as userState}from"../../../../../store/user/index";import{ScCustomerFirstname}from"../sc-customer-firstname";describe("sc-customer-firstname",(()=>{beforeEach((()=>{disposeCheckout(),disposeUser()}));const t=[{testLabel:"Customer and Checkout first name provided",checkout:{first_name:"CheckoutFirst",customer:{first_name:"CustomerFirst"}}},{testLabel:"Customer first name provided",checkout:{customer:{first_name:"CustomerFirst"}}},{testLabel:"Checkout first name provided",checkout:{first_name:"CheckoutFirst"}}];function e(t){global.window=Object.create(window),Object.defineProperty(window,"location",{value:{search:t?new URLSearchParams("?first_name=UrlFirst").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 s=await newSpecPage({components:[ScCustomerFirstname],html:"<sc-customer-firstname></sc-customer-firstname>"});expect(s.root).toMatchSnapshot(),s.rootInstance.disconnectedCallback()})),it(`${t.testLabel} without URL Params`,(async()=>{e(!1),userState.loggedIn=!0,checkoutState.checkout=t.checkout;const s=await newSpecPage({components:[ScCustomerFirstname],html:"<sc-customer-firstname></sc-customer-firstname>"});expect(s.root).toMatchSnapshot(),s.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 s=await newSpecPage({components:[ScCustomerFirstname],html:"<sc-customer-firstname></sc-customer-firstname>"});expect(s.root).toMatchSnapshot(),s.rootInstance.disconnectedCallback()})),it(`${t.testLabel} without URL Params`,(async()=>{e(!1),userState.loggedIn=!1,checkoutState.checkout=t.checkout;const s=await newSpecPage({components:[ScCustomerFirstname],html:"<sc-customer-firstname></sc-customer-firstname>"});expect(s.root).toMatchSnapshot(),s.rootInstance.disconnectedCallback()}))}))}));