Skip to content

Commit

Permalink
verify deployment option
Browse files Browse the repository at this point in the history
  • Loading branch information
ArijitCloud committed Oct 5, 2024
1 parent 8140866 commit 7aa2388
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
pnpm-lock.yaml
coverage
dist
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"test:coverage": "jest --coverage",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 10",
"preview": "vite preview"
"preview": "vite preview",
"verify": "eslint && jest && vite build && vite preview"
},
"dependencies": {
"@heroicons/react": "^2.1.5",
Expand Down
6 changes: 3 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from "react";
import { HeaderBar, FilterNav, Content, QuickNav } from "./layouts";
import { useFetchReducer, SearchProvider } from "./state";
import { useFetchReducer, SearchContextProvider } from "./state";
import { Footer } from "./layouts/Footer";

const allFilter = "All";
Expand Down Expand Up @@ -28,7 +28,7 @@ function App() {
style={{ scrollbarGutter: "stable" }}
className="h-screen flex flex-col flex-grow overflow-auto px-2 sm:px-10 text-black dark:text-white"
>
<SearchProvider>
<SearchContextProvider>
<header className="sticky top-0 z-40 bg-white dark:bg-gray-bg py-4 px-6">
<HeaderBar />
<FilterNav categories={categories} loading={loading} />
Expand All @@ -43,7 +43,7 @@ function App() {
showSaved={showSaved}
/>
</main>
</SearchProvider>
</SearchContextProvider>
<footer className="py-4 text-center text-gray-500 dark:text-gray-400 mt-auto">
<Footer />
</footer>
Expand Down
4 changes: 3 additions & 1 deletion src/data/response.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export interface FeedResponse {
}

export interface RawAlbumEntry {
[key: string]: unknown;
// Raw data from the API. Subject to frequent changes.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}

export interface AlbumEntry {
Expand Down
27 changes: 14 additions & 13 deletions src/state/SearchContext.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { render, screen, fireEvent } from "@testing-library/react";
import "@testing-library/jest-dom";
import { SearchProvider, useSearchContext } from "./SearchContext";
import { SearchContextProvider } from "./SearchContextProvider";
import { useSearchReducer } from "./useSearchReducer";
import { useSearchContext } from "./useSearchContext";

/** Mocks */
jest.mock("./useSearchReducer");
Expand Down Expand Up @@ -62,9 +63,9 @@ const TestComponent = () => {
describe("SearchContext", () => {
it("provides initial state correctly", () => {
render(
<SearchProvider>
<SearchContextProvider>
<TestComponent />
</SearchProvider>
</SearchContextProvider>
);

expect(screen.getByTestId("query")).toHaveTextContent("");
Expand All @@ -76,9 +77,9 @@ describe("SearchContext", () => {

it("updates query when setQuery is called", () => {
render(
<SearchProvider>
<SearchContextProvider>
<TestComponent />
</SearchProvider>
</SearchContextProvider>
);

fireEvent.click(screen.getByText("Set Query"));
Expand All @@ -87,9 +88,9 @@ describe("SearchContext", () => {

it("updates selectedFilter when setSelectedFilter is called", () => {
render(
<SearchProvider>
<SearchContextProvider>
<TestComponent />
</SearchProvider>
</SearchContextProvider>
);

fireEvent.click(screen.getByText("Set Filter"));
Expand All @@ -98,9 +99,9 @@ describe("SearchContext", () => {

it("updates savedIds when setSavedIds is called", () => {
render(
<SearchProvider>
<SearchContextProvider>
<TestComponent />
</SearchProvider>
</SearchContextProvider>
);

fireEvent.click(screen.getByText("Set Saved IDs"));
Expand All @@ -109,9 +110,9 @@ describe("SearchContext", () => {

it("updates sortOption when setSortOption is called", () => {
render(
<SearchProvider>
<SearchContextProvider>
<TestComponent />
</SearchProvider>
</SearchContextProvider>
);

fireEvent.click(screen.getByText("Set Sort Option"));
Expand All @@ -120,9 +121,9 @@ describe("SearchContext", () => {

it("updates dataView when setDataView is called", () => {
render(
<SearchProvider>
<SearchContextProvider>
<TestComponent />
</SearchProvider>
</SearchContextProvider>
);

fireEvent.click(screen.getByText("Set Data View"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ReactNode } from "react";
import { useSearchReducer } from "./useSearchReducer";
import { SearchContext } from "./useSearchContext";

const SearchProvider = ({ children }: { children: ReactNode }) => {
const SearchContextProvider = ({ children }: { children: ReactNode }) => {
const initialContext = useSearchReducer();

return (
Expand All @@ -12,4 +12,4 @@ const SearchProvider = ({ children }: { children: ReactNode }) => {
);
};

export { SearchProvider };
export { SearchContextProvider };
2 changes: 1 addition & 1 deletion src/state/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as FavoriteManager } from "./FavoriteManager";
export { SearchProvider } from "./SearchContext";
export { SearchContextProvider } from "./SearchContextProvider";
export { useFetchReducer } from "./useFetchReducer";
export { SearchContext, useSearchContext } from "./useSearchContext";

0 comments on commit 7aa2388

Please sign in to comment.