diff --git a/app/(pages)/_layout.tsx b/app/(pages)/_layout.tsx deleted file mode 100644 index 8b5f90e..0000000 --- a/app/(pages)/_layout.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { Slot } from "expo-router" - -const Layout: React.FC = () => { - return -} - -export default Layout diff --git a/app/_layout.tsx b/app/_layout.tsx index 8b0adca..2abb980 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -43,9 +43,7 @@ const StackLayout: React.FC = () => { screenOptions={{ headerShown: false, }} - > - - + /> ) } diff --git a/app/(pages)/application/_layout.tsx b/app/application/_layout.tsx similarity index 95% rename from app/(pages)/application/_layout.tsx rename to app/application/_layout.tsx index 9a0133f..8f2eb1b 100644 --- a/app/(pages)/application/_layout.tsx +++ b/app/application/_layout.tsx @@ -8,7 +8,7 @@ const TabLayout: React.FC = () => { const { user } = useAuthentication() if (user == null) { - return + return } return ( diff --git a/app/(pages)/application/habits/history.tsx b/app/application/habits/history.tsx similarity index 100% rename from app/(pages)/application/habits/history.tsx rename to app/application/habits/history.tsx diff --git a/app/(pages)/application/habits/index.tsx b/app/application/habits/index.tsx similarity index 100% rename from app/(pages)/application/habits/index.tsx rename to app/application/habits/index.tsx diff --git a/app/(pages)/application/habits/new.tsx b/app/application/habits/new.tsx similarity index 100% rename from app/(pages)/application/habits/new.tsx rename to app/application/habits/new.tsx diff --git a/app/(pages)/application/users/settings.tsx b/app/application/users/settings.tsx similarity index 100% rename from app/(pages)/application/users/settings.tsx rename to app/application/users/settings.tsx diff --git a/app/(pages)/authentication/_layout.tsx b/app/authentication/_layout.tsx similarity index 93% rename from app/(pages)/authentication/_layout.tsx rename to app/authentication/_layout.tsx index 152f67f..cadac6f 100644 --- a/app/(pages)/authentication/_layout.tsx +++ b/app/authentication/_layout.tsx @@ -8,7 +8,7 @@ const TabLayout: React.FC = () => { const { user } = useAuthentication() if (user != null) { - return + return } return ( diff --git a/app/(pages)/authentication/login.tsx b/app/authentication/login.tsx similarity index 100% rename from app/(pages)/authentication/login.tsx rename to app/authentication/login.tsx diff --git a/app/(pages)/authentication/register.tsx b/app/authentication/register.tsx similarity index 100% rename from app/(pages)/authentication/register.tsx rename to app/authentication/register.tsx diff --git a/app/(pages)/index.tsx b/app/index.tsx similarity index 68% rename from app/(pages)/index.tsx rename to app/index.tsx index 33e8657..c8c246b 100644 --- a/app/(pages)/index.tsx +++ b/app/index.tsx @@ -6,10 +6,10 @@ const HomePage: React.FC = () => { const { user } = useAuthentication() if (user == null) { - return + return } - return + return } export default HomePage diff --git a/docs/CONVENTIONS.md b/docs/CONVENTIONS.md index 5c54e70..c37cf09 100644 --- a/docs/CONVENTIONS.md +++ b/docs/CONVENTIONS.md @@ -14,6 +14,9 @@ npm run lint:typescript # Test npm run test + +# Test Snapshots Update +npm run test -- --u ``` Une pipeline CI ([`.gitlab-ci.yml`](../.gitlab-ci.yml)) est en place pour vérifier que le code respecte ces bonnes pratiques et que les tests passent. diff --git a/infrastructure/index.ts b/infrastructure/instances.ts similarity index 75% rename from infrastructure/index.ts rename to infrastructure/instances.ts index 5a3aa72..a2ede57 100644 --- a/infrastructure/index.ts +++ b/infrastructure/instances.ts @@ -1,10 +1,10 @@ import { AuthenticationUseCase } from "@/domain/use-cases/Authentication" import { RetrieveHabitsTrackerUseCase } from "../domain/use-cases/RetrieveHabitsTracker" import { HabitsTrackerPresenter } from "../presentation/presenters/HabitsTracker" -import { AuthenticationSupabaseRepository } from "./repositories/supabase/lib/AuthenticationRepository" -import { GetHabitProgressHistorySupabaseRepository } from "./repositories/supabase/lib/GetHabitProgressHistory" -import { GetHabitsByUserIdSupabaseRepository } from "./repositories/supabase/lib/GetHabitsByUserId" -import { supabaseClient } from "./repositories/supabase/supabase" +import { AuthenticationSupabaseRepository } from "./supabase/repositories/Authentication" +import { GetHabitProgressHistorySupabaseRepository } from "./supabase/repositories/GetHabitProgressHistory" +import { GetHabitsByUserIdSupabaseRepository } from "./supabase/repositories/GetHabitsByUserId" +import { supabaseClient } from "./supabase/supabase" import { AuthenticationPresenter } from "@/presentation/presenters/Authentication" /** diff --git a/infrastructure/repositories/supabase/.gitignore b/infrastructure/supabase/.gitignore similarity index 100% rename from infrastructure/repositories/supabase/.gitignore rename to infrastructure/supabase/.gitignore diff --git a/infrastructure/repositories/supabase/config.toml b/infrastructure/supabase/config.toml similarity index 100% rename from infrastructure/repositories/supabase/config.toml rename to infrastructure/supabase/config.toml diff --git a/infrastructure/repositories/supabase/migrations/20240315152340_initial_schema.sql b/infrastructure/supabase/migrations/20240315152340_initial_schema.sql similarity index 100% rename from infrastructure/repositories/supabase/migrations/20240315152340_initial_schema.sql rename to infrastructure/supabase/migrations/20240315152340_initial_schema.sql diff --git a/infrastructure/repositories/supabase/lib/AuthenticationRepository.ts b/infrastructure/supabase/repositories/Authentication.ts similarity index 100% rename from infrastructure/repositories/supabase/lib/AuthenticationRepository.ts rename to infrastructure/supabase/repositories/Authentication.ts diff --git a/infrastructure/repositories/supabase/lib/GetHabitProgressHistory.ts b/infrastructure/supabase/repositories/GetHabitProgressHistory.ts similarity index 100% rename from infrastructure/repositories/supabase/lib/GetHabitProgressHistory.ts rename to infrastructure/supabase/repositories/GetHabitProgressHistory.ts diff --git a/infrastructure/repositories/supabase/lib/GetHabitsByUserId.ts b/infrastructure/supabase/repositories/GetHabitsByUserId.ts similarity index 100% rename from infrastructure/repositories/supabase/lib/GetHabitsByUserId.ts rename to infrastructure/supabase/repositories/GetHabitsByUserId.ts diff --git a/infrastructure/repositories/supabase/lib/_SupabaseRepository.ts b/infrastructure/supabase/repositories/_SupabaseRepository.ts similarity index 100% rename from infrastructure/repositories/supabase/lib/_SupabaseRepository.ts rename to infrastructure/supabase/repositories/_SupabaseRepository.ts diff --git a/infrastructure/repositories/supabase/seed.sql b/infrastructure/supabase/seed.sql similarity index 100% rename from infrastructure/repositories/supabase/seed.sql rename to infrastructure/supabase/seed.sql diff --git a/infrastructure/repositories/supabase/supabase-types.ts b/infrastructure/supabase/supabase-types.ts similarity index 100% rename from infrastructure/repositories/supabase/supabase-types.ts rename to infrastructure/supabase/supabase-types.ts diff --git a/infrastructure/repositories/supabase/supabase.ts b/infrastructure/supabase/supabase.ts similarity index 100% rename from infrastructure/repositories/supabase/supabase.ts rename to infrastructure/supabase/supabase.ts diff --git a/package.json b/package.json index e6635c7..2203eab 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "lint:typescript": "tsc --noEmit", "lint:staged": "lint-staged", "test": "jest --reporters=default --reporters=jest-junit", - "supabase": "supabase --workdir \"./infrastructure/repositories\"", + "supabase": "supabase --workdir \"./infrastructure\"", "postinstall": "husky" }, "dependencies": { diff --git a/presentation/react/components/ButtonCustom.tsx b/presentation/react/components/ButtonCustom.tsx deleted file mode 100644 index 9fc1e72..0000000 --- a/presentation/react/components/ButtonCustom.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { StyleProp, ViewStyle } from "react-native" -import { Pressable, StyleSheet, Text } from "react-native" - -export interface ButtonCustomProps - extends React.ComponentProps { - children: React.ReactNode - style?: StyleProp -} - -export const ButtonCustom: React.FC = (props) => { - const { children, style, ...rest } = props - - return ( - - {children} - - ) -} - -const styles = StyleSheet.create({ - button: { - padding: 10, - borderWidth: 1, - borderColor: "black", - borderRadius: 10, - marginTop: 10, - backgroundColor: "#152B5D", - }, - text: { - color: "white", - textAlign: "center", - fontSize: 15, - }, -}) diff --git a/presentation/react/components/MonoText.tsx b/presentation/react/components/MonoText.tsx deleted file mode 100644 index 6012cb5..0000000 --- a/presentation/react/components/MonoText.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { StyleSheet, Text } from "react-native" - -export const MonoText: React.FC = (props) => { - const { style, ...rest } = props - - return -} - -const styles = StyleSheet.create({ - text: { - fontFamily: "SpaceMono", - }, -}) diff --git a/presentation/react/components/__tests__/ButtonCustom.test.tsx b/presentation/react/components/__tests__/ButtonCustom.test.tsx deleted file mode 100644 index 0491962..0000000 --- a/presentation/react/components/__tests__/ButtonCustom.test.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import renderer from "react-test-renderer" - -import { ButtonCustom } from "@/presentation/react/components/ButtonCustom" - -describe("", () => { - it("renders correctly", () => { - const tree = renderer - .create(Awesome Button!) - .toJSON() - expect(tree).toMatchSnapshot() - }) -}) diff --git a/presentation/react/components/__tests__/MonoText.test.tsx b/presentation/react/components/__tests__/MonoText.test.tsx deleted file mode 100644 index 9d9c749..0000000 --- a/presentation/react/components/__tests__/MonoText.test.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import renderer from "react-test-renderer" - -import { MonoText } from "@/presentation/react/components/MonoText" - -describe("", () => { - it("renders correctly", () => { - const tree = renderer.create(Awesome text!).toJSON() - expect(tree).toMatchSnapshot() - }) -}) diff --git a/presentation/react/components/__tests__/TabBarIcon.test.tsx b/presentation/react/components/__tests__/TabBarIcon.test.tsx new file mode 100644 index 0000000..6e9fd0f --- /dev/null +++ b/presentation/react/components/__tests__/TabBarIcon.test.tsx @@ -0,0 +1,12 @@ +import renderer from "react-test-renderer" + +import { TabBarIcon } from "@/presentation/react/components/TabBarIcon" + +describe("", () => { + it("renders correctly", () => { + const tree = renderer + .create() + .toJSON() + expect(tree).toMatchSnapshot() + }) +}) diff --git a/presentation/react/components/__tests__/__snapshots__/ButtonCustom.test.tsx.snap b/presentation/react/components/__tests__/__snapshots__/ButtonCustom.test.tsx.snap deleted file mode 100644 index 0cd38a0..0000000 --- a/presentation/react/components/__tests__/__snapshots__/ButtonCustom.test.tsx.snap +++ /dev/null @@ -1,60 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` renders correctly 1`] = ` - - - Awesome Button! - - -`; diff --git a/presentation/react/components/__tests__/__snapshots__/MonoText.test.tsx.snap b/presentation/react/components/__tests__/__snapshots__/MonoText.test.tsx.snap deleted file mode 100644 index ccda730..0000000 --- a/presentation/react/components/__tests__/__snapshots__/MonoText.test.tsx.snap +++ /dev/null @@ -1,16 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` renders correctly 1`] = ` - - Awesome text! - -`; diff --git a/presentation/react/components/__tests__/__snapshots__/TabBarIcon.test.tsx.snap b/presentation/react/components/__tests__/__snapshots__/TabBarIcon.test.tsx.snap new file mode 100644 index 0000000..a185ce2 --- /dev/null +++ b/presentation/react/components/__tests__/__snapshots__/TabBarIcon.test.tsx.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` renders correctly 1`] = ``; diff --git a/presentation/react/contexts/Authentication.tsx b/presentation/react/contexts/Authentication.tsx index c0cf020..85c507c 100644 --- a/presentation/react/contexts/Authentication.tsx +++ b/presentation/react/contexts/Authentication.tsx @@ -5,7 +5,7 @@ import type { AuthenticationPresenter, AuthenticationPresenterState, } from "@/presentation/presenters/Authentication" -import { authenticationPresenter } from "@/infrastructure" +import { authenticationPresenter } from "@/infrastructure/instances" export interface AuthenticationContextValue extends AuthenticationPresenterState { diff --git a/presentation/react/contexts/HabitsTracker.tsx b/presentation/react/contexts/HabitsTracker.tsx index bb96249..a4b1948 100644 --- a/presentation/react/contexts/HabitsTracker.tsx +++ b/presentation/react/contexts/HabitsTracker.tsx @@ -5,7 +5,7 @@ import type { HabitsTrackerPresenterState, } from "@/presentation/presenters/HabitsTracker" import { usePresenterState } from "@/presentation/react/hooks/usePresenterState" -import { habitsTrackerPresenter } from "@/infrastructure" +import { habitsTrackerPresenter } from "@/infrastructure/instances" import { useAuthentication } from "./Authentication" export interface HabitsTrackerContextValue extends HabitsTrackerPresenterState {