github.test.ts 606 B

12345678910111213141516171819202122
  1. import { describe, expect, it, vi } from 'vitest'
  2. import { getGitHubProfileImgUrl, openInstallGitHubIntegrationWindow } from './github'
  3. // mock window.open
  4. vi.stubGlobal('open', vi.fn())
  5. describe('openInstallGitHubIntegrationWindow', () => {
  6. it('should open the install window', () => {
  7. openInstallGitHubIntegrationWindow('install')
  8. expect(window.open).toHaveBeenCalled()
  9. })
  10. })
  11. describe('getGitHubProfileImgUrl', () => {
  12. it('should return the correct URL', () => {
  13. const result = getGitHubProfileImgUrl('test')
  14. expect(result).toBe('https://github.com/test.png?size=96')
  15. })
  16. })