Files
iNaturalistReactNative/tests/unit/components/SharedComponents/ObservationsFlashList/ObsStatus.test.js
Johannes Klein a44f0412f3 Hide observation status for logged out users on simple MyObs (#2710)
* Show simple my obs header only for logged-in users

* ActivityCount TS

* CommentsCount TS

* IdentificationsCount TS

* ObsStatus TS initial pass not looking at errors

* QualityGradeStatus TS

* Update RealmObservation interface

* Update RealmObservation interface

* ObsUploadStatus TS, plain copy, no errors yet

* Update types

* Update type

* IconicTaxonIcon TS

* ObsImage TS

* PhotoCount TS

* ObsImagePreview TS

* Image is only opaque when logged in

* DateDisplay TS

* Remove debug flag from UploadObsStatus

* Update type

* Prop to hide ObsUploadStatus

* Test observations need those otherwise they appear as needing edit

* Update imports
2025-03-04 09:01:21 +01:00

46 lines
1004 B
JavaScript

import {
screen
} from "@testing-library/react-native";
import ObsStatus from "components/SharedComponents/ObsStatus.tsx";
import React from "react";
import factory from "tests/factory";
import { renderComponent } from "tests/helpers/render";
const mockObservation = factory( "LocalObservation", {
identifications: [
factory( "LocalIdentification", {
current: true
} ),
factory( "LocalIdentification", {
current: false
} )
],
comments: []
} );
describe( "ObsStatus", () => {
it( "displays count for current ids, not withdrawn ids", () => {
renderComponent(
<ObsStatus
observation={mockObservation}
/>
);
const idCount = screen.getByText( /1/ );
expect( idCount ).toBeVisible( );
} );
it( "displays comment count", () => {
renderComponent(
<ObsStatus
observation={mockObservation}
/>
);
const commentCount = screen.getByText( /0/ );
expect( commentCount ).toBeVisible( );
} );
} );