-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Some clean up, added Spotify icon for offline/loading state * Minor clean up in Mobile view * Updating about text. * Fixing max width for the Tab Panel * P-18: fixed bug when type is not track * P-20: Add real time spotify streaming progress bar. (#21) * P-23: Added experience section. (#24) * P-26: Added placeholder projects section. (#27) * Wip footer. * develop: some footer updates, brb. * develop: simple footer. * P-11 (#31) * P-11: added vitest, react testing library config for unit testing. * P-11: add Projects unit test. * P-11: fix bg card color. * P-11 (#32) * P-11: added vitest, react testing library config for unit testing. * P-11: add Projects unit test. * P-11: fix bg card color. * P-11: almost done, missing Github actions and TODOS in test. * Update src/components/Navigation/Navigation.test.tsx
- Loading branch information
1 parent
67070ec
commit 1225812
Showing
28 changed files
with
2,129 additions
and
87 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { describe, test, expect } from "vitest"; | ||
import { screen } from "@testing-library/react"; | ||
import { renderWithQueryProvider } from "../../utils.tests"; | ||
import About from "./About"; | ||
import { ABOUT_ME_TEXT } from "../utils"; | ||
|
||
describe("<About />", () => { | ||
test("Displays proper information", () => { | ||
renderWithQueryProvider(<About />); | ||
const textNode = screen.getByTestId("about"); | ||
expect(textNode.textContent).toBe(ABOUT_ME_TEXT); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ABOUT_ME_TEXT } from "../utils"; | ||
import { SpotifyNowPlaying } from "../"; | ||
import { Typography, Stack } from "@mui/material"; | ||
|
||
export default function About() { | ||
return ( | ||
<Stack spacing={1} color="info.main"> | ||
<Typography data-testid="about" fontSize={[16, 18]}> | ||
{ABOUT_ME_TEXT} | ||
</Typography> | ||
<SpotifyNowPlaying /> | ||
</Stack> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { describe, test, expect } from "vitest"; | ||
import { screen, within } from "@testing-library/react"; | ||
import { renderWithQueryProvider } from "../../utils.tests"; | ||
import { COMPANIES } from "../../constants"; | ||
import Experience from "./Experience"; | ||
|
||
describe("<Experience />", () => { | ||
test("Displays proper information per company", () => { | ||
renderWithQueryProvider(<Experience />); | ||
|
||
const chipWrappers = screen.getAllByTestId("chip-wrapper"); | ||
const jobLists = screen.getAllByTestId("jobs"); | ||
|
||
COMPANIES.forEach((company, index) => { | ||
// Name | ||
screen.getByText(company.name); | ||
// Date | ||
screen.getByText(company.duration); | ||
|
||
// Tech as chips | ||
const chips = within(chipWrappers[index]).getAllByTestId("chip"); | ||
expect(chips).toHaveLength(company.tech.length); | ||
|
||
// Job descriptions | ||
const jobListItems = within(jobLists[index]).getAllByRole("listitem"); | ||
expect(jobListItems).toHaveLength(company.jobs.length); | ||
company.jobs.forEach((job, jobIndex) => { | ||
expect(jobListItems[jobIndex].textContent).toBe(job); | ||
}); | ||
|
||
// Clickable image | ||
const iconButton = screen.getByRole("link", { name: company.name }); | ||
expect(iconButton.getAttribute("href")).toContain(company.url); | ||
expect(iconButton.getAttribute("target")).toContain("_blank"); | ||
const img = within(iconButton) | ||
.getByRole("img", { name: company.name }) | ||
.getAttribute("src"); | ||
expect(img).toContain(company.logo); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { screen, within } from "@testing-library/react"; | ||
import { renderWithQueryProvider } from "../../utils.tests"; | ||
import Footer from "./Footer"; | ||
import MTLogo from "../../assets/mt.png"; | ||
|
||
describe("<Footer />", () => { | ||
test("Displays proper information", () => { | ||
renderWithQueryProvider(<Footer />); | ||
|
||
screen.getByText("© Maria Torrente 2024"); | ||
|
||
// Clickable MT Logo | ||
const iconButton = screen.getByRole("link"); | ||
expect(iconButton.getAttribute("href")).toContain("#"); | ||
const img = within(iconButton) | ||
.getByRole("img", { name: "Maria Torrente" }) | ||
.getAttribute("src"); | ||
expect(img).toContain(MTLogo); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { describe, test } from "vitest"; | ||
import { renderWithQueryProvider } from "../../utils.tests"; | ||
import Navigation from "./Navigation"; | ||
|
||
// TODO: understand MUI error with `theme` usages, mainly custom properties. | ||
describe.skip("<Navigation />", () => { | ||
test("Displays proper information per project", () => { | ||
renderWithQueryProvider(<Navigation />); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { describe, test, expect } from "vitest"; | ||
import { screen, within } from "@testing-library/react"; | ||
import { renderWithQueryProvider } from "../../utils.tests"; | ||
import { PROJECTS } from "../../constants"; | ||
import Projects from "./Projects"; | ||
|
||
describe("<Projects />", () => { | ||
test("Displays proper information per project", () => { | ||
renderWithQueryProvider(<Projects />); | ||
|
||
const actions = screen.getAllByTestId("card-actions"); | ||
|
||
PROJECTS.forEach((project, index) => { | ||
// Title | ||
screen.getByText(project.title); | ||
// Description | ||
screen.getByText(project.description); | ||
|
||
// Tech | ||
project.tech.forEach((tech) => { | ||
screen.getAllByText(tech); | ||
}); | ||
|
||
// Card Actions | ||
const footerLinks = within(actions[index]).getAllByRole("link"); | ||
expect(footerLinks[0].getAttribute("href")).toContain(project.repoLink); | ||
expect(footerLinks[1].getAttribute("href")).toContain(project.prodLink); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/components/SpotifyNowPlaying/SpotifyNowPlaying.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { describe, test } from "vitest"; | ||
import { screen, waitForElementToBeRemoved } from "@testing-library/react"; | ||
import { renderWithQueryProvider } from "../../utils.tests"; | ||
import SpotifyNowPlaying from "./SpotifyNowPlaying"; | ||
|
||
describe("<SpotifyNowPLaying />", () => { | ||
test("Displays message when no session available.", () => { | ||
renderWithQueryProvider(<SpotifyNowPlaying />); | ||
expect( | ||
screen.getByText( | ||
"Maria's tunes are on pause, she's probably rocking out at a concert!" | ||
) | ||
); | ||
}); | ||
|
||
//TODO: debug why is not getting beyond getAccessToken mock. | ||
test.skip("Displays message when session is online.", async () => { | ||
renderWithQueryProvider(<SpotifyNowPlaying />); | ||
await waitForElementToBeRemoved( | ||
screen.getAllByText("Syncing to Maria's Tunes...") | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export { default as About } from "./About"; | ||
export { default as Navigation } from "./Navigation"; | ||
export { default as Experience } from "./Experience"; | ||
export { default as Projects } from "./Projects"; | ||
export { default as SpotifyNowPlaying } from "./SpotifyNowPlaying"; | ||
export { default as Footer } from "./Footer"; | ||
export { default as About } from "./About/About"; | ||
export { default as Navigation } from "./Navigation/Navigation"; | ||
export { default as Experience } from "./Experience/Experience"; | ||
export { default as Projects } from "./Projects/Projects"; | ||
export { default as SpotifyNowPlaying } from "./SpotifyNowPlaying/SpotifyNowPlaying"; | ||
export { default as Footer } from "./Footer/Footer"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
export const CLIENT_ID = import.meta.env.VITE_APP_SPOTIFY_CLIENT_ID; | ||
export const CLIENT_SECRET = import.meta.env.VITE_APP_SPOTIFY_CLIENT_SECRET; | ||
export const REFRESH_TOKEN = import.meta.env.VITE_APP_SPOTIFY_REFRESH_TOKEN; | ||
export const ENV = import.meta.env.VITE_APP_NODE_ENV; | ||
export const TOKEN_ENDPOINT = "https://accounts.spotify.com/api/token"; | ||
export const NOW_PLAYING_ENDPOINT = | ||
"https://api.spotify.com/v1/me/player/currently-playing"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.