MOB-1000 mock user to fix unit test flake

This commit is contained in:
Ryan Stelly
2025-11-06 12:56:39 -06:00
parent e5f98eb2d9
commit 7086d00d42

View File

@@ -2,6 +2,7 @@ import { screen, waitFor } from "@testing-library/react-native";
import ObsEdit from "components/ObsEdit/ObsEdit";
import React from "react";
import { View } from "react-native";
import * as useCurrentUser from "sharedHooks/useCurrentUser";
import useStore from "stores/useStore";
import factory from "tests/factory";
import { renderComponent, wrapInNavigationContainer } from "tests/helpers/render";
@@ -48,6 +49,7 @@ const mockObservation = factory( "LocalObservation", {
describe( "ObsEdit", () => {
beforeEach( ( ) => {
jest.spyOn( useCurrentUser, "default" ).mockImplementation( ( ) => mockUser );
useStore.setState( {
currentObservation: mockObservation,
observations: [mockObservation]