import{h}from"@stencil/core";import{newSpecPage}from"@stencil/core/testing";import{state as checkoutStore,dispose}from"../../../../../store/checkout/index";import{ScCustomerPhone}from"../sc-customer-phone";describe("sc-customer-phone",(()=>{beforeEach((()=>{dispose()})),it("renders",(async()=>{const e=await newSpecPage({components:[ScCustomerPhone],html:"<sc-customer-phone></sc-customer-phone>"});expect(e.root).toMatchSnapshot(),e.rootInstance.disconnectedCallback()})),it("Uses the customer phone number on load",(async()=>{const e=await newSpecPage({components:[ScCustomerPhone],template:()=>h("sc-customer-phone",null)});checkoutStore.checkout={customer:{phone:"999"}},await e.waitForChanges(),expect(e.root).toMatchSnapshot(),e.rootInstance.disconnectedCallback()})),it("Uses the checkout phone number on load",(async()=>{const e=await newSpecPage({components:[ScCustomerPhone],template:()=>h("sc-customer-phone",null)});checkoutStore.checkout={phone:"111"},await e.waitForChanges(),expect(e.root).toMatchSnapshot(),e.rootInstance.disconnectedCallback()})),it("Uses checkout as a preference if both customer and checkout load a phone number.",(async()=>{const e=await newSpecPage({components:[ScCustomerPhone],template:()=>h("sc-customer-phone",null)});checkoutStore.checkout={phone:"111",customer:{phone:"999"}},await e.waitForChanges(),expect(e.root).toMatchSnapshot(),e.rootInstance.disconnectedCallback()}))}));