Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(BSR) refactor(Settings): remove SettingsContext #7593

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

xlecunff-pass
Copy link
Contributor

Comme React Query gère son cache qui est déjà accessible depuis n'importe quelle partie de l'application, il me semblait inutile d'y accéder via un contexte React

@xlecunff-pass xlecunff-pass changed the title Remove settings context 2 (BSR) refactor(Settings): remove SettingsContext Jan 28, 2025
@xlecunff-pass xlecunff-pass force-pushed the remove-settings-context-2 branch 2 times, most recently from 58099f6 to 283323a Compare January 28, 2025 14:33
@xlecunff-pass xlecunff-pass marked this pull request as draft January 29, 2025 14:51
@xlecunff-pass xlecunff-pass force-pushed the remove-settings-context-2 branch 17 times, most recently from e754306 to 90d3d91 Compare February 6, 2025 13:46
@xlecunff-pass xlecunff-pass marked this pull request as ready for review February 6, 2025 13:47
@xlecunff-pass xlecunff-pass force-pushed the remove-settings-context-2 branch 4 times, most recently from 4ec4a68 to 7426ebb Compare February 7, 2025 14:22
@xlecunff-pass xlecunff-pass force-pushed the remove-settings-context-2 branch from 7426ebb to 98c7a76 Compare February 10, 2025 13:26
@xlecunff-pass xlecunff-pass force-pushed the remove-settings-context-2 branch from 62c52ec to 7520abb Compare February 10, 2025 16:01
Copy link
Contributor

@bebstein-pass bebstein-pass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je suis étonné que les settings soient nécessaires dans autant de tests

je pense que ça ne devrait pas etre un BSR, tu peux voir avec @lbeneston-pass pour créer un ticket

[QueryKeys.SETTINGS],
() => api.getNativeV1Settings(),
{
staleTime: STALE_TIME_APP_SETTINGS,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avant on avait, ça, ce n'est plus nécessaire ?

enabled: !!netInfo.isConnected && !!netInfo.isInternetReachable,

Comment on lines +54 to +55
expect(result.current.offers[0]?.objectID).toEqual(offersFixture[0].objectID)
expect(result.current.offers[1]?.objectID).toEqual(offersFixture[1].objectID)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je trouvais l'expect d'avant plus explicite

pourquoi a-t-on besoin de le changer ?

Comment on lines +13 to +17
mockSettings()

jest.mock('features/identityCheck/context/SubscriptionContextProvider')
jest.mock('ui/theme/customFocusOutline/customFocusOutline')
mockSettings()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je pense qu'une seule fois serait suffisante

renderSetAddress()

const input = screen.getByPlaceholderText('Ex\u00a0: 34 avenue de l’Opéra')
fireEvent.changeText(input, QUERY_ADDRESS)

fireEvent.press(screen.getByText('Continuer'))

await screen.findByText('Recherche et sélectionne ton adresse')
await screen.findByText('Entre ton adresse')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment ça se fait que ça passait avant ?

() => api.getNativeV1Settings(),
{
staleTime: STALE_TIME_APP_SETTINGS,
initialData: defaultSettings,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avant, on n'avait pas de données par défaut

le defaultSettings actuellement utilisé est censé etre utilisé par des tests, avec des données invalides en prod

exemple: on a un localhost qui traine dedans

objectStorageUrl: 'https://localhost-storage',

je ne suis pas contre avoir des données par défaut

je pense qu'il faudrait éviter d'utiliser cette fixture

jest.mock('styled-components/native')
jest.mock('features/auth/context/SettingsContext')
jest.mock('libs/monitoring/services')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment ça se fait qu'avant on n'en avait pas besoin ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants