mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 08:47:44 +00:00
feat: open repo secrets page in addition to README (#5684)
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
isGitHubRepository,
|
||||
getGitRepoRoot,
|
||||
getLatestGitHubRelease,
|
||||
getGitHubRepoInfo,
|
||||
} from './gitUtils.js';
|
||||
|
||||
vi.mock('child_process');
|
||||
@@ -44,6 +45,39 @@ describe('isGitHubRepository', async () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getGitHubRepoInfo', async () => {
|
||||
beforeEach(() => {
|
||||
vi.resetAllMocks();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('throws an error if github repo info cannot be determined', async () => {
|
||||
vi.mocked(child_process.execSync).mockImplementation((): string => {
|
||||
throw new Error('oops');
|
||||
});
|
||||
expect(() => {
|
||||
getGitHubRepoInfo();
|
||||
}).toThrowError(/oops/);
|
||||
});
|
||||
|
||||
it('throws an error if owner/repo could not be determined', async () => {
|
||||
vi.mocked(child_process.execSync).mockReturnValueOnce('');
|
||||
expect(() => {
|
||||
getGitHubRepoInfo();
|
||||
}).toThrowError(/Owner & repo could not be extracted from remote URL/);
|
||||
});
|
||||
|
||||
it('returns the owner and repo', async () => {
|
||||
vi.mocked(child_process.execSync).mockReturnValueOnce(
|
||||
'https://github.com/owner/repo.git ',
|
||||
);
|
||||
expect(getGitHubRepoInfo()).toEqual({ owner: 'owner', repo: 'repo' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('getGitRepoRoot', async () => {
|
||||
beforeEach(() => {
|
||||
vi.resetAllMocks();
|
||||
|
||||
Reference in New Issue
Block a user