Files
iNaturalistReactNative/tests/unit/components/SharedComponents/UploadStatus/UploadStatus.test.js
Johannes Klein b4516b7b25 Update react native to v0.78.x (#3043)
* Update package.json

* Update package.json

* Updates for native files with upgrade-helpers

* Update .flowconfig

* Update package-lock.json

* Update Podfile.lock

* Add react-dom types

* Update package-lock.json

* Wrong install

* Use types-react-codemod

* Update TaxonSearch.tsx

* Remove react-native-accessibility-engine dependency

This is currently not maintained and not compatible with RN 0.78

* Comment out accessibility tests

* Disable broken snapshot test

* Move broken test

* Move broken test

* Move broken test

* Remove duplicate file

* Move broken tests

* Move broken tests

* Move broken tests

* Move broken tests

* Move broken tests

* Move broken test

* Remove duplicate file

* Move broken tests
2025-08-09 13:47:46 +02:00

47 lines
1.6 KiB
JavaScript

import { render, screen } from "@testing-library/react-native";
import { UploadStatus } from "components/SharedComponents";
import React from "react";
import useStore from "stores/useStore";
const initialStoreState = useStore.getState( );
beforeAll( ( ) => {
useStore.setState( initialStoreState, true );
} );
jest.mock( "react-native-circular-progress-indicator", () => "CircularProgress" );
describe( "UploadStatus", () => {
it( "displays start icon when upload is unsynced and not queued", async () => {
render( <UploadStatus progress={0} queued={false} /> );
expect( screen.getByTestId( /UploadIcon.start/ ) ).toBeTruthy();
expect( screen ).toMatchSnapshot();
} );
it( "displays rotating circle progress when upload is queued but not started", async () => {
render( <UploadStatus progress={0} queued /> );
expect( screen.getByTestId( "UploadStatus.QueuedRotatingIcon" ) ).toBeTruthy();
expect( screen ).toMatchSnapshot();
} );
it( "displays progress bar when progress is greater than 5%", async () => {
render( <UploadStatus progress={0.5} /> );
expect( screen.getByTestId( "UploadStatus.CircularProgress" ) ).toBeTruthy();
expect( screen ).toMatchSnapshot();
} );
it( "displays complete icon when progress is 1", async () => {
render( <UploadStatus progress={1} /> );
expect( screen.getByTestId( "UploadStatus.Complete" ) ).toBeTruthy();
expect( screen ).toMatchSnapshot();
} );
it( "has no accessibility errors", () => {
// Disabled during the update to RN 0.78
// expect( <UploadStatus progress={0.5} /> ).toBeAccessible();
} );
} );