1
+ import { checkPlatform } from './checkPlatform' ;
2
+ import { LEGACY_AVAILABLE_PLATFORMS } from './constants' ;
3
+ import { describe , it , expect } from 'vitest' ;
4
+
5
+ describe ( 'checkPlatform' , ( ) => {
6
+ it ( 'should return "darwin" for MacOS .app tar.gz files' , ( ) => {
7
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . MacOS , 'myApp.app.tar.gz' ) ) . toBe ( 'darwin' ) ;
8
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . MacOS , 'myApp.darwin.tar.gz' ) ) . toBe ( 'darwin' ) ;
9
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . MacOS , 'myApp.osx.tar.gz' ) ) . toBe ( 'darwin' ) ;
10
+ } ) ;
11
+
12
+ it ( 'should return "win64" for Windows 64 bits zip files' , ( ) => {
13
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . Win64 , 'myApp.x64.zip' ) ) . toBe ( 'win64' ) ;
14
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . Win64 , 'myApp.win64.zip' ) ) . toBe ( 'win64' ) ;
15
+ } ) ;
16
+
17
+ it ( 'should return "win32" for Windows 32 bits zip files' , ( ) => {
18
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . Win32 , 'myApp.x32.zip' ) ) . toBe ( 'win32' ) ;
19
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . Win32 , 'myApp.win32.zip' ) ) . toBe ( 'win32' ) ;
20
+ } ) ;
21
+
22
+ it ( 'should return "linux" for Linux AppImage gz files' , ( ) => {
23
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . Linux , 'myApp.AppImage.tar.gz' ) ) . toBe ( 'linux' ) ;
24
+ } ) ;
25
+
26
+ it ( 'should return undefined for non-matching files' , ( ) => {
27
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . MacOS , 'myApp.exe' ) ) . toBeUndefined ( ) ;
28
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . Win64 , 'myApp.app.tar.gz' ) ) . toBeUndefined ( ) ;
29
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . Win32 , 'myApp.AppImage.tar.gz' ) ) . toBeUndefined ( ) ;
30
+ expect ( checkPlatform ( LEGACY_AVAILABLE_PLATFORMS . Linux , 'myApp.x64.zip' ) ) . toBeUndefined ( ) ;
31
+ } ) ;
32
+ } ) ;
0 commit comments