mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-01-22 12:49:11 -05:00
* Remove delete option for observations not in realm * Add mutation for delete observation * Hide delete option for observations not persisted to realm * Close kebab menu when item pressed; this allows dialog to respond to first user press Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
import { NavigationContainer } from "@react-navigation/native";
|
|
import {
|
|
QueryClient,
|
|
QueryClientProvider
|
|
} from "@tanstack/react-query";
|
|
import { render } from "@testing-library/react-native";
|
|
import App from "components/App";
|
|
import React from "react";
|
|
|
|
const queryClient = new QueryClient( {
|
|
defaultOptions: {
|
|
queries: {
|
|
// No need to do default retries in tests
|
|
retry: false,
|
|
// Prevent `Jest did not exit one second after the test run has completed.` error
|
|
// https://react-query-v3.tanstack.com/guides/testing#set-cachetime-to-infinity-with-jest
|
|
cacheTime: Infinity
|
|
}
|
|
}
|
|
} );
|
|
|
|
function renderComponent( component, update = null ) {
|
|
const renderMethod = update || render;
|
|
return renderMethod(
|
|
<QueryClientProvider client={queryClient}>
|
|
<NavigationContainer>
|
|
{ component }
|
|
</NavigationContainer>
|
|
</QueryClientProvider>
|
|
);
|
|
}
|
|
|
|
function renderAppWithComponent( component, update = null ) {
|
|
return renderComponent( <App>{ component }</App>, update );
|
|
}
|
|
|
|
export {
|
|
renderAppWithComponent,
|
|
renderComponent
|
|
};
|