Code coverage report for api.js

# All files api.js

73.33% Statements 11/15
66.67% Branches 4/6
71.43% Functions 5/7
81.82% Lines 9/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24

    5x
    3x
    3x

    3x
    3x
    2x

    2x

    1x
    1x

     import 'isomorphic-fetch'

    export async function APIRequest(who) {
      if (who === 'facebook') {
        const call1 = fetch('https://facebook.com/someOtherResource').then(res =>
          res.json()
        )
        const call2 = fetch('https://facebook.com').then(res => res.json())
        return Promise.all([call1, call2])
      } else Iif (who === 'twitter') {
        return fetch('https://twitter.com').then(res => res.json())
      } else {
        return fetch('https://google.com').then(res => res.json())
      }
    }

    export function APIRequest2(who) {
      Eif (who === 'google') {
        return fetch('https://google.com').then(res => res.json())
      } else {
        return 'no argument provided'
      }
    }