mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-09 17:19:02 +00:00
test(scripts): cover greenfield versions list E404
This commit is contained in:
parent
5d2f168b13
commit
34088b0481
1 changed files with 22 additions and 0 deletions
|
|
@ -281,6 +281,28 @@ describe('getVersion', () => {
|
|||
expect(result.previousReleaseTag).toBe('');
|
||||
});
|
||||
|
||||
it('should handle E404 from versions list in true greenfield scenario', () => {
|
||||
const mockGreenfieldVersionsE404 = (command) => {
|
||||
if (command.includes('npm view') && command.includes('versions --json'))
|
||||
throw new Error('npm error code E404');
|
||||
if (
|
||||
command.includes('npm view') &&
|
||||
command.includes('--tag=') &&
|
||||
!command.includes('versions --json')
|
||||
) {
|
||||
throw new Error('npm error code E404');
|
||||
}
|
||||
|
||||
return mockExecSync(command);
|
||||
};
|
||||
vi.mocked(execSync).mockImplementation(mockGreenfieldVersionsE404);
|
||||
|
||||
const result = getVersion({ type: 'stable' });
|
||||
expect(result.releaseVersion).toBe('0.8.0');
|
||||
expect(result.npmTag).toBe('latest');
|
||||
expect(result.previousReleaseTag).toBe('');
|
||||
});
|
||||
|
||||
it('should derive baseline from versions list when dist-tag is missing but versions exist', () => {
|
||||
const mockWithVersionsButNoTag = (command) => {
|
||||
if (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue