mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-30 17:38:48 -05:00
* 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
50 lines
1.6 KiB
JavaScript
50 lines
1.6 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} />;
|
|
|
|
// Disabled during the update to RN 0.78
|
|
// 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 );
|
|
} );
|
|
} );
|