|
1 | 1 | import { rcompare } from 'semver'; |
2 | 2 | import { describe, it, expect } from 'vitest'; |
| 3 | +import { parseTarget } from '../../../tools/generate-release-manifest'; |
3 | 4 |
|
4 | 5 | describe('Generate Release Manifest', () => { |
5 | 6 | describe('semver version sorting within environments', () => { |
@@ -29,4 +30,54 @@ describe('Generate Release Manifest', () => { |
29 | 30 | expect(sorted).toEqual(['v1.2.0', 'v1.1.0', 'v1.0.0']); |
30 | 31 | }); |
31 | 32 | }); |
| 33 | + |
| 34 | + describe('parseTarget', () => { |
| 35 | + it('should parse linux with glib postfix', () => { |
| 36 | + expect(parseTarget('cloudformation-languageserver-1.2.0-alpha-linuxglib2.28-x64-node18.zip')).toEqual({ |
| 37 | + platform: 'linuxglib2.28', |
| 38 | + arch: 'x64', |
| 39 | + nodejs: '18', |
| 40 | + }); |
| 41 | + }); |
| 42 | + |
| 43 | + it('should parse linux without postfix', () => { |
| 44 | + expect(parseTarget('cloudformation-languageserver-1.2.0-alpha-linux-arm64-node22.zip')).toEqual({ |
| 45 | + platform: 'linux', |
| 46 | + arch: 'arm64', |
| 47 | + nodejs: '22', |
| 48 | + }); |
| 49 | + }); |
| 50 | + |
| 51 | + it('should parse darwin', () => { |
| 52 | + expect(parseTarget('cloudformation-languageserver-1.2.0-alpha-darwin-arm64-node22.zip')).toEqual({ |
| 53 | + platform: 'darwin', |
| 54 | + arch: 'arm64', |
| 55 | + nodejs: '22', |
| 56 | + }); |
| 57 | + }); |
| 58 | + |
| 59 | + it('should parse win32', () => { |
| 60 | + expect(parseTarget('cloudformation-languageserver-1.2.0-alpha-win32-x64-node22.zip')).toEqual({ |
| 61 | + platform: 'win32', |
| 62 | + arch: 'x64', |
| 63 | + nodejs: '22', |
| 64 | + }); |
| 65 | + }); |
| 66 | + |
| 67 | + it('should parse without nodejs version', () => { |
| 68 | + expect(parseTarget('cloudformation-languageserver-1.2.0-linux-x64.zip')).toEqual({ |
| 69 | + platform: 'linux', |
| 70 | + arch: 'x64', |
| 71 | + nodejs: undefined, |
| 72 | + }); |
| 73 | + }); |
| 74 | + |
| 75 | + it('should return null for non-zip files', () => { |
| 76 | + expect(parseTarget('cloudformation-languageserver-1.2.0-linux-x64.tar.gz')).toBeNull(); |
| 77 | + }); |
| 78 | + |
| 79 | + it('should return null for invalid architecture', () => { |
| 80 | + expect(parseTarget('cloudformation-languageserver-1.2.0-linux-i386.zip')).toBeNull(); |
| 81 | + }); |
| 82 | + }); |
32 | 83 | }); |
0 commit comments