@@ -3,19 +3,41 @@ import { describe, it } from "node:test";
33import { getPlatformPackage } from "../../scripts/configure.mjs" ;
44
55describe ( "getPlatformPackage()" , ( ) => {
6- const name = "react-native-macos" ;
6+ const macosName = "react-native-macos" ;
7+ const windowsName = "react-native-windows" ;
78
89 it ( "returns dependency when target version is inside range" , ( t ) => {
910 const warnMock = t . mock . method ( console , "warn" , ( ) => null ) ;
1011
1112 for ( const targetVersion of [ "0.0.0-canary" , "^0.0.0-canary" ] ) {
1213 const pkg = getPlatformPackage ( "macos" , targetVersion ) ;
13- deepEqual ( pkg , { [ name ] : "^0.0.0" } ) ;
14+ deepEqual ( pkg , { [ macosName ] : "^0.0.0" } ) ;
1415 }
1516
1617 for ( const targetVersion of [ "0.78" , "0.78.6" , "^0.78" , "^0.78.6" ] ) {
1718 const pkg = getPlatformPackage ( "macos" , targetVersion ) ;
18- deepEqual ( pkg , { [ name ] : "^0.78.0" } ) ;
19+ deepEqual ( pkg , { [ macosName ] : "^0.78.0" } ) ;
20+ }
21+
22+ for ( const targetVersion of [ "0.81" , "0.81.0" , "^0.81" , "^0.81.0" ] ) {
23+ const pkg = getPlatformPackage ( "macos" , targetVersion ) ;
24+ deepEqual ( pkg , { [ macosName ] : "^0.81.0" } ) ;
25+ }
26+
27+ equal ( warnMock . mock . calls . length , 0 ) ;
28+ } ) ;
29+
30+ it ( "returns dependency for windows when target version is inside range" , ( t ) => {
31+ const warnMock = t . mock . method ( console , "warn" , ( ) => null ) ;
32+
33+ for ( const targetVersion of [ "0.80" , "0.80.0" , "^0.80" , "^0.80.0" ] ) {
34+ const pkg = getPlatformPackage ( "windows" , targetVersion ) ;
35+ deepEqual ( pkg , { [ windowsName ] : "^0.80.0" } ) ;
36+ }
37+
38+ for ( const targetVersion of [ "0.81" , "0.81.0" , "^0.81" , "^0.81.0" ] ) {
39+ const pkg = getPlatformPackage ( "windows" , targetVersion ) ;
40+ deepEqual ( pkg , { [ windowsName ] : "^0.81.0" } ) ;
1941 }
2042
2143 equal ( warnMock . mock . calls . length , 0 ) ;
0 commit comments