Files
iNaturalistReactNative/tests/unit/components/ObsDetails/FaveButton.test.js
Ken-ichi e6b5cb8aa6 Obs details sounds (#1062)
* Extracted non-photo stuff from PhotoDisplay
* Separate component for FaveButton
* Prevent faves while signed out
* Separate component for nav header
* Stick nav header while scrolling until tabs
* Nav header has slight gradient for visibility over white content
* Renamed ObsDetails media components so they're not focused on photos
* Data and layout changes leading up to sound player on ObsDetail
* Add sound player to ObsDetails
* Swiping away while playing should pause playback
* Swiping back to sound and playing again should resume where you left off
* Allow viewing media while offline (images may be cached)
* Stop playback when navigating away from ObsDetails
* Fetch sounds in Explore so we can show sound icon
* Map all observation objects in explore with Realm-ish attributes
2024-01-22 13:12:01 -08:00

35 lines
871 B
JavaScript

import FaveButton from "components/ObsDetails/FaveButton";
import initI18next from "i18n/initI18next";
import React from "react";
import factory from "tests/factory";
import { renderComponent } from "tests/helpers/render";
describe( "FaveButton", () => {
beforeAll( async ( ) => {
await initI18next( );
} );
it( "should survive no currentUser", ( ) => {
expect(
( ) => renderComponent(
<FaveButton
observation={factory( "LocalObservation" )}
/>
)
).not.toThrow( );
} );
it( "should survive no currentUser for an observation w/ existing faves", ( ) => {
const observation = factory( "RemoteObservation", {
faves: [factory( "RemoteVote" )]
} );
expect(
( ) => renderComponent(
<FaveButton
observation={observation}
/>
)
).not.toThrow( );
} );
} );