Skip to content

Commit

Permalink
fix #380/shouldUseEnrichEndpoint respect enrich value (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amin Mahboubi authored Sep 15, 2020
1 parent fe8ceab commit b6e97a3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ export class StreamClient<
withRecentReactions?: boolean;
} = {},
) {
if (options.enrich) {
if (options.enrich !== undefined) {
const result = options.enrich;
delete options.enrich;
return result;
Expand Down
28 changes: 28 additions & 0 deletions test/unit/common/feed_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,34 @@ describe('[UNIT] Stream Feed (Common)', function () {
}),
);
});

it('(5) enrich undefined', function () {
feed.get({});

td.verify(
get(
td.matchers.contains({
url: feed.client.enrichByDefault ? 'enrich/feed/user/matthisk/' : 'feed/user/matthisk/',
qs: {},
}),
),
);
});

it('(6) enrich true', function () {
feed.get({ enrich: true });
td.verify(get(td.matchers.contains({ url: 'enrich/feed/user/matthisk/' })));
});

it('(7) enrich false', function () {
feed.get({ enrich: false });
td.verify(get(td.matchers.contains({ url: 'feed/user/matthisk/' })));
});

it('(8) enrich false with ownReactions true', function () {
feed.get({ enrich: false, ownReactions: true });
td.verify(get(td.matchers.contains({ url: 'feed/user/matthisk/' })));
});
});

describe('#subscribe', function () {
Expand Down

0 comments on commit b6e97a3

Please sign in to comment.