Skip to content

Commit 431984b

Browse files
committed
Fix TS error
1 parent 0425b5a commit 431984b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/withLDConsumer.test.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ describe('withLDConsumer', () => {
3434

3535
test('ldClient is passed down through context api', () => {
3636
const Home = (props: HocProps) => (
37-
<div>{props.ldClient && props.ldClient.track ? 'ldClient detected' : 'Negative, no ldClient'}</div>
37+
<div>
38+
{props.ldClient && Object.hasOwnProperty.call(props.ldClient, 'track')
39+
? 'ldClient detected'
40+
: 'Negative, no ldClient'}
41+
</div>
3842
);
3943
const HomeWithFlags = withLDConsumer()(Home);
4044
const component = create(<HomeWithFlags />);
@@ -45,7 +49,9 @@ describe('withLDConsumer', () => {
4549
const Home = (props: HocProps) => (
4650
<div>
4751
{props.flags ? 'flags detected' : 'Negative, no flag'}
48-
{props.ldClient && props.ldClient.track ? 'ldClient detected' : 'Negative, no ldClient'}
52+
{props.ldClient && Object.hasOwnProperty.call(props.ldClient, 'track')
53+
? 'ldClient detected'
54+
: 'Negative, no ldClient'}
4955
</div>
5056
);
5157
const HomeWithFlags = withLDConsumer({ clientOnly: true })(Home);

0 commit comments

Comments
 (0)