From 84e3dff663080c22d17b5a0bcf3caddb95c131d0 Mon Sep 17 00:00:00 2001 From: Joshua Hall Date: Thu, 28 Jun 2018 11:11:56 -0500 Subject: [PATCH] Updated tests with new private field to check if profile is private --- types/overwatch-api/overwatch-api-tests.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/types/overwatch-api/overwatch-api-tests.ts b/types/overwatch-api/overwatch-api-tests.ts index bd4df128a0..cfdf140b92 100644 --- a/types/overwatch-api/overwatch-api-tests.ts +++ b/types/overwatch-api/overwatch-api-tests.ts @@ -6,10 +6,14 @@ const battleTag = 'sparK#12434'; getProfile(platform, region, battleTag, (err: Error | null, data: ProfileApiResponse) => { if (err === null) { - console.log(`Username: ${data.username}`); - console.log(`Level: ${data.level}`); - console.log(`Rank: ${data.competitive.rank} SR`); - console.log(`Win Rate in Competitive: ${data.games.competitive.win_rate}`); + if (data.private === false) { + console.log(`Username: ${data.username}`); + console.log(`Level: ${data.level}`); + console.log(`Rank: ${data.competitive.rank} SR`); + console.log(`Win Rate in Competitive: ${data.games.competitive.win_rate}`); + } else { + console.log(`Profile for battletag ${battleTag} is private, cannot retrieve profile`); + } } else { console.log(err); }