Liferay.Loader.define("@liferay/analytics-settings-web@5.0.51/js/pages/default/__tests__/DefaultPage.spec",["module","exports","require","liferay!frontend-js-react-web$react","@liferay!analytics-settings-web$testing-library/jest-dom/extend-expect","@liferay!analytics-settings-web$testing-library/react","liferay!analytics-settings-web$jest-fetch-mock","../../../components/attributes/Attributes","../../../components/people/People","../../../components/properties/Properties","../../../utils/__tests__/mocks","../DefaultPage"],(function(e,t,n){window;{var r=_interopRequireDefault(n("liferay!frontend-js-react-web$react"));n("@liferay!analytics-settings-web$testing-library/jest-dom/extend-expect");var a=n("@liferay!analytics-settings-web$testing-library/react"),s=_interopRequireDefault(n("liferay!analytics-settings-web$jest-fetch-mock")),o=_interopRequireDefault(n("../../../components/attributes/Attributes")),l=_interopRequireDefault(n("../../../components/people/People")),i=_interopRequireDefault(n("../../../components/properties/Properties")),c=n("../../../utils/__tests__/mocks"),u=_interopRequireDefault(n("../DefaultPage"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}describe("DefaultPage",(()=>{afterEach((()=>{jest.restoreAllMocks()})),it("renders DefaultPage component without crashing ",(()=>{const{getByText:e}=(0,a.render)(r.default.createElement(u.default,null)),t=e("Menu");expect(t).toBeInTheDocument()})),it("renders the Workspace Connection page based on the selected menu item",(async()=>{const{findByRole:e}=(0,a.render)(r.default.createElement(u.default,null));a.fireEvent.click(await e("menuitem",{name:"workspace-connection"}));const t=document.querySelector(".sheet-title");expect(t).toBeInTheDocument(),expect(null==t?void 0:t.textContent).toBe("workspace-connection")})),it("renders the People page based on the selected menu item",(async()=>{await(0,a.act)((async()=>{const{findByRole:e}=(0,a.render)(r.default.createElement(u.default,null));a.fireEvent.click(await e("menuitem",{name:"people"})),s.default.mockResponse(JSON.stringify({syncAllAccounts:!1,syncAllContacts:!1,syncedAccountGroupIds:[],syncedOrganizationIds:[],syncedUserGroupIds:[]})),(0,a.render)(r.default.createElement(l.default,null));const t=document.querySelector(".sheet-title");expect(t).toBeInTheDocument(),expect(null==t?void 0:t.textContent).toBe("people")}))})),it("renders the Properties page based on the selected menu item",(async()=>{await(0,a.act)((async()=>{const{findByRole:e}=(0,a.render)(r.default.createElement(u.default,null));a.fireEvent.click(await e("menuitem",{name:"properties"})),s.default.mockResponse(JSON.stringify(c.fetchPropertiesResponse)),(0,a.render)(r.default.createElement(i.default,null));const t=document.querySelector(".sheet-title");expect(t).toBeInTheDocument(),expect(null==t?void 0:t.textContent).toBe("properties")}))})),it("renders the Attributes page based on the selected menu item",(async()=>{await(0,a.act)((async()=>{const{findByRole:e}=(0,a.render)(r.default.createElement(u.default,null));a.fireEvent.click(await e("menuitem",{name:"attributes"})),s.default.mockResponse(JSON.stringify({account:25,order:35,people:44,product:34})),(0,a.render)(r.default.createElement(o.default,null));const t=document.querySelector(".sheet-title");expect(t).toBeInTheDocument(),expect(null==t?void 0:t.textContent).toBe("attributes")}))}))}))}}));
//# sourceMappingURL=DefaultPage.spec.js.map