mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-02-20 07:47:44 -05:00
* refactor: convert UserIcon to TypeScript * feat: show simple MyObs to signed in user; add user icon & login to header * feat: show warning and edit button for unuploaded obs w/o basics * refactor: consolidate ObsEdit navigation logic * feat: show edit button with circle dots * refactor: upload UploadQueuedRotatingIcon to the more reusable CircleDots component * refactor: upload icons to use more composition and fewer specialized, one-off components * fix: bugs in determining if an obs has date and coords * refactor: extract MyObservationsSimple business logic into container * refactor: get total obs count from relevant hooks * feat: show remote species for signed in users * fix: hide photo count icon when missing basics icon is present * feat: show banner alerting user when missing location or date Closes MOB-318
49 lines
1.5 KiB
JavaScript
49 lines
1.5 KiB
JavaScript
import { render, screen } from "@testing-library/react-native";
|
|
import { UserIcon } from "components/SharedComponents";
|
|
import React from "react";
|
|
|
|
// Can't user faker or the snapshot will be unstable
|
|
const mockUri = "https://loremflickr.com/640/480?lock=4455548378415104";
|
|
|
|
describe( "UserIcon", () => {
|
|
it( "should not have accessibility erros", () => {
|
|
const userIcon = <UserIcon uri={mockUri} />;
|
|
|
|
expect( userIcon ).toBeAccessible();
|
|
} );
|
|
|
|
it( "displays user image correctly", () => {
|
|
render( <UserIcon uri={mockUri} /> );
|
|
|
|
// Snapshot test
|
|
expect( screen ).toMatchSnapshot();
|
|
} );
|
|
|
|
it( "displays small user image correctly", () => {
|
|
render( <UserIcon uri={mockUri} small /> );
|
|
|
|
// Snapshot test
|
|
expect( screen ).toMatchSnapshot();
|
|
} );
|
|
|
|
it( "displays active user image correctly", () => {
|
|
render( <UserIcon uri={mockUri} active /> );
|
|
|
|
// Snapshot test
|
|
expect( screen ).toMatchSnapshot();
|
|
} );
|
|
|
|
it( "shows correct uri for the user icon image", () => {
|
|
render( <UserIcon uri={mockUri} active /> );
|
|
|
|
// TODO: replace with getByRole
|
|
const profilePicture = screen.getByTestId( "UserIcon.photo" );
|
|
// FasterImage doesn't provide a TS-compliant way to specify a test ID, so
|
|
// I'm not sure how else we'd access it
|
|
// eslint-disable-next-line testing-library/no-node-access
|
|
expect( profilePicture.children[0] ).toBeTruthy();
|
|
// eslint-disable-next-line testing-library/no-node-access
|
|
expect( profilePicture.children[0].props.source ).toHaveProperty( "url", mockUri );
|
|
} );
|
|
} );
|