@@ -72,6 +72,7 @@ describe("Npm installation manager tests", () => {
72
72
let expectedLatestCompatibleVersion = "1.4.0" ;
73
73
assert . equal ( actualLatestCompatibleVersion , expectedLatestCompatibleVersion ) ;
74
74
} ) ;
75
+
75
76
it ( "returns correct latest compatible version" , ( ) => {
76
77
let testInjector = createTestInjector ( ) ;
77
78
@@ -92,4 +93,23 @@ describe("Npm installation manager tests", () => {
92
93
let expectedLatestCompatibleVersion = "1.3.3" ;
93
94
assert . equal ( actualLatestCompatibleVersion , expectedLatestCompatibleVersion ) ;
94
95
} ) ;
96
+
97
+ it ( "returns correct latest compatible version" , ( ) => {
98
+ let testInjector = createTestInjector ( ) ;
99
+
100
+ let versions = [ "1.2.0" , "1.3.0" , "1.3.1" , "1.3.2" , "1.3.3" , "1.4.0" ] ;
101
+ let latestVersion = _ . last ( versions ) ;
102
+ mockNpm ( testInjector , versions , latestVersion ) ;
103
+
104
+ // Mock staticConfig.version
105
+ let staticConfig = testInjector . resolve ( "staticConfig" ) ;
106
+ staticConfig . version = "1.5.0" ;
107
+
108
+ // Mock npmInstallationManager.getLatestVersion
109
+ let npmInstallationManager = testInjector . resolve ( "npmInstallationManager" ) ;
110
+ npmInstallationManager . getLatestVersion = ( packageName : string ) => Future . fromResult ( latestVersion ) ;
111
+
112
+ let actualLatestCompatibleVersion = npmInstallationManager . getLatestCompatibleVersion ( "" ) . wait ( ) ;
113
+ assert . equal ( actualLatestCompatibleVersion , latestVersion ) ;
114
+ } ) ;
95
115
} ) ;
0 commit comments