jest.mock("@store/checkouts/store",(()=>({__esModule:!0,default:{state:{live:{},test:{}},set:jest.fn(),get:jest.fn(),onChange:jest.fn(),on:jest.fn(),dispose:jest.fn()},state:{live:{},test:{}},set:jest.fn(),get:jest.fn(),onChange:jest.fn(),on:jest.fn(),dispose:jest.fn()})));import{h}from"@stencil/core";import{newSpecPage}from"@stencil/core/testing";import{dispose as disposeCheckout,state as checkoutState}from"../../../../../store/checkout/index";import{ScOrderBumps}from"../sc-order-bumps";describe("sc-order-bump",(()=>{beforeEach((()=>{disposeCheckout()})),it("renders empty if no bumps",(async()=>{const e=await newSpecPage({components:[ScOrderBumps],template:()=>h("sc-order-bumps",null)});expect(e.root).toMatchSnapshot()})),it("renders default label",(async()=>{checkoutState.checkout={id:"test",recommended_bumps:{data:[{name:"Test",amount_off:123,price:{amount:123,currency:"USD",product:{id:"test",name:"Test",description:"Test",variants:{pagination:{count:0}}}}}]}};const e=await newSpecPage({components:[ScOrderBumps],template:()=>h("sc-order-bumps",null)});expect(e.root).toMatchSnapshot()})),it("renders custom label",(async()=>{checkoutState.checkout={id:"test",recommended_bumps:{data:[{name:"Test",amount_off:123,price:{amount:123,currency:"USD",product:{id:"test",name:"Test",description:"Test",variants:{pagination:{count:0}}}}}]}};const e=await newSpecPage({components:[ScOrderBumps],template:()=>h("sc-order-bumps",{label:"custom"})});expect(e.root).toMatchSnapshot()}));const e={id:"test",line_items:{data:[{id:"line-item-id",bump:"bump-id"}]},recommended_bumps:{data:[{id:"bump-id",name:"Test",amount_off:123,price:{amount:123,currency:"USD",product:{id:"test",name:"Test",description:"Test",variants:{pagination:{count:0}}}}}]}};it("hides bumps already added to the checkout when hideAddedItems is set",(async()=>{checkoutState.checkout=e;const t=await newSpecPage({components:[ScOrderBumps],template:()=>h("sc-order-bumps",{hideAddedItems:!0})});expect(t.root.shadowRoot.querySelector("sc-order-bump")).toBeNull()})),it("keeps added bumps visible when hideAddedItems is not set",(async()=>{checkoutState.checkout=e;const t=await newSpecPage({components:[ScOrderBumps],template:()=>h("sc-order-bumps",null)});expect(t.root.shadowRoot.querySelector("sc-order-bump")).not.toBeNull()}))}));