"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
const react_1 = __importDefault(require("react"));
const react_2 = require("@testing-library/react");
const UserLoginModal_1 = require("../UserLoginModal");
const react_router_dom_1 = require("react-router-dom");
const loginUrls = {
    google: "https://openneuro.org/crn/auth/google",
    orcid: "https://openneuro.org/crn/auth/orcid",
};
const toggle = vitest_1.vi.fn();
describe("UserLoginModal component", () => {
    it("Google login link has correctly formed auth URL", () => {
        (0, react_2.render)(react_1.default.createElement(react_router_dom_1.MemoryRouter, { initialEntries: ["/import?url=https://example.com"] },
            react_1.default.createElement(UserLoginModal_1.UserLoginModal, { isOpen: true, toggle: toggle, loginUrls: loginUrls })));
        expect(react_2.screen.getByRole("link", { name: /google/i }).getAttribute("href")).toBe("https://openneuro.org/crn/auth/google?redirectPath=L2ltcG9ydD91cmw9aHR0cHM6Ly9leGFtcGxlLmNvbQ==");
    });
    it("ORCID login link has correctly formed auth URL", () => {
        (0, react_2.render)(react_1.default.createElement(react_router_dom_1.MemoryRouter, { initialEntries: ["/import"] },
            react_1.default.createElement(UserLoginModal_1.UserLoginModal, { isOpen: true, toggle: toggle, loginUrls: loginUrls })));
        expect(react_2.screen.getByRole("link", { name: /orcid/i }).getAttribute("href")).toBe("https://openneuro.org/crn/auth/orcid?redirectPath=L2ltcG9ydA==");
    });
});
