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