Skip to content

Commit

Permalink
Fixed tests to add flag inat.isV2. Implements inaturalist#89
Browse files Browse the repository at this point in the history
  • Loading branch information
viatrix committed Aug 11, 2020
1 parent 839f3ab commit 7ffebcc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/inaturalist_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,25 @@ describe( "InaturalistAPI", ( ) => {

describe( "lookupPreferredPlaceMiddleware", ( ) => {
it( "looks up preferred_place by preferred_place_id", done => {
const req = { query: { preferred_place_id: 1, locale: "zh-LP" } };
const req = { query: { preferred_place_id: 1, locale: "zh-LP"}, inat: {} };
InaturalistAPI.lookupPreferredPlaceMiddleware( req, null, () => {
expect( req.inat.preferredPlace.id ).to.eq( 1 );
done( );
} );
} );

it( "looks up preferred_place by locale", done => {
const req = { query: { locale: "zh-LP" } };
const req = { query: { locale: "zh-LP" }, inat: {} };
InaturalistAPI.lookupPreferredPlaceMiddleware( req, null, () => {
expect( req.inat.preferredPlace.id ).to.eq( 511 );
done( );
} );
} );

it( "does not set preferred_place if locale is malformed", done => {
const req = { query: { locale: "zh-LP-LP" } };
const req = { query: { locale: "zh-LP-LP" }, inat: {} };
InaturalistAPI.lookupPreferredPlaceMiddleware( req, null, () => {
expect( req.inat ).to.be.undefined;
expect( req.inat.preferredPlace ).to.be.undefined;
done( );
} );
} );
Expand Down

0 comments on commit 7ffebcc

Please sign in to comment.