__tests__/github.test.js

Summary

Maintainability
A
0 mins
Test Coverage

import github from '@/github.js'

beforeEach(() => {
  global.Headers = class Headers {
    append () {}
  }
  global.Request = class Request {}
  global.fetch = () => {
    return {
      json() {
        return { msg: 'test' }
      }
    }
  }
})

test('github.js', async () => {
  expect.assertions(1)
  const res = await github()
  expect(res).toEqual({ msg: 'test' })
})