{message}
+ + + } + /> + ); +} diff --git a/packages/app-kit/src/popup/AuthPopup.test.tsx b/packages/app-kit/src/popup/AuthPopup.test.tsx new file mode 100644 index 0000000..1c419cf --- /dev/null +++ b/packages/app-kit/src/popup/AuthPopup.test.tsx @@ -0,0 +1,133 @@ +"use client"; + +import { describe, it, expect, vi, afterEach } from "vitest"; +import { render, screen, fireEvent, cleanup } from "@testing-library/react"; +import AuthPopup from "./AuthPopup"; + +const spotifyOnlyDescription = ( + <> + My Library requires Spotify to access your saved tracks and playlists. + > +); +const defaultDescription = ( + <> + My App requires sign-in to access your library + > +); + +describe("AuthPopup", () => { + afterEach(() => { + cleanup(); + }); + + it("calls handleSpotifyOAuth with redirectAfterAuthPath when the Spotify button is clicked", () => { + const handleSpotifyOAuth = vi.fn(); + render( +{message}
} ++ {spotifyOnly ? spotifyOnlyDescription : defaultDescription} +
++ Please try again. If the problem persists, contact us at{" "} + + {contactEmail} + +
++ It seems that you are not connected to the internet. Please check your connection and try again. +
+ + } + /> + ); +} diff --git a/packages/app-kit/src/popup/SpotifyAuthErrorPopup.test.tsx b/packages/app-kit/src/popup/SpotifyAuthErrorPopup.test.tsx new file mode 100644 index 0000000..ff58035 --- /dev/null +++ b/packages/app-kit/src/popup/SpotifyAuthErrorPopup.test.tsx @@ -0,0 +1,53 @@ +"use client"; + +import { describe, it, expect, vi, afterEach } from "vitest"; +import { render, screen, fireEvent, cleanup } from "@testing-library/react"; +import SpotifyAuthErrorPopup from "./SpotifyAuthErrorPopup"; + +describe("SpotifyAuthErrorPopup", () => { + afterEach(() => { + cleanup(); + }); + + it("renders the message", () => { + render({message}
+ {details && ( +{details}
+ )} ++ The Spotify app is in development mode, so only allowlisted accounts can connect. +
+ {requestAccessHref && contactEmail ? ( ++ Request access by emailing your{" "} + + Spotify full name and Spotify email address + {" "} + to{" "} + + {contactEmail} + + . +
+ ) : ( +To request access, contact the app owner.
+ )} +