diff --git a/client/src/entry/analysis/modules/ResetPassword.test.ts b/client/src/entry/analysis/modules/ResetPassword.test.ts new file mode 100644 index 000000000000..95e4bac64c95 --- /dev/null +++ b/client/src/entry/analysis/modules/ResetPassword.test.ts @@ -0,0 +1,64 @@ +import { createTestingPinia } from "@pinia/testing"; +import { getLocalVue } from "@tests/jest/helpers"; +import { mount } from "@vue/test-utils"; +import { setActivePinia } from "pinia"; + +import { getGalaxyInstance } from "@/app/singleton"; + +import ResetPassword from "./ResetPassword.vue"; + +const localVue = getLocalVue(true); + +const configMock = { + allow_user_creation: true, + enable_oidc: true, + mailing_join_addr: "mailing_join_addr", + prefer_custos_login: true, + registration_warning_message: "registration_warning_message", + server_mail_configured: true, + show_welcome_with_login: true, + terms_url: "terms_url", + welcome_url: "welcome_url", +}; + +jest.mock("app/singleton"); +jest.mock("@/composables/config", () => ({ + useConfig: jest.fn(() => ({ + config: configMock, + + isConfigLoaded: true, + })), +})); + +const mockRouter = (query: object) => ({ + currentRoute: { + query, + }, +}); + +(getGalaxyInstance as jest.Mock).mockReturnValue({ session_csrf_token: "session_csrf_token" }); + +function mountResetPassword(routerQuery: object = {}) { + const pinia = createTestingPinia(); + setActivePinia(pinia); + + return mount(ResetPassword, { + localVue, + pinia, + mocks: { + $router: mockRouter(routerQuery), + }, + }); +} + +describe("ResetPassword", () => { + it("ResetPassword index attribute matching", async () => { + const wrapper = mountResetPassword({ + redirect: "redirect_url", + }); + + console.log("wrapper:", wrapper.html()); + const emailForm = wrapper.find("#reset-email"); + console.log("emailForm:", emailForm.element); + }); +}); diff --git a/client/src/entry/analysis/modules/ResetPassword.vue b/client/src/entry/analysis/modules/ResetPassword.vue index 3078e87e5ac8..1b68f4dc1088 100644 --- a/client/src/entry/analysis/modules/ResetPassword.vue +++ b/client/src/entry/analysis/modules/ResetPassword.vue @@ -36,7 +36,7 @@ async function resetLogin() { - + Reset your password