11import os from "os" ;
22import * as path from "path" ;
33import * as vs from "../src/visual-studio" ;
4- import { swiftPackage } from "../src/swift-versions " ;
4+ import { getPackage } from "../src/swift-package " ;
55import { OS , System } from "../src/os" ;
66
77jest . mock ( "fs" , ( ) => {
@@ -29,7 +29,7 @@ describe("visual studio resolver", () => {
2929 it ( "fetches visual studio requirement for swift version" , async ( ) => {
3030 jest . spyOn ( os , "release" ) . mockReturnValue ( "10.0.17763" ) ;
3131
32- const req5_3 = vs . vsRequirement ( swiftPackage ( "5.3" , windows ) ) ;
32+ const req5_3 = vs . vsRequirement ( await getPackage ( "5.3" , windows ) ) ;
3333 expect ( req5_3 . version ) . toBe ( "16" ) ;
3434 expect ( req5_3 . components ) . toContain (
3535 "Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
@@ -38,7 +38,7 @@ describe("visual studio resolver", () => {
3838 "Microsoft.VisualStudio.Component.Windows10SDK.17763"
3939 ) ;
4040
41- const req5_6 = vs . vsRequirement ( swiftPackage ( "5.6" , windows ) ) ;
41+ const req5_6 = vs . vsRequirement ( await getPackage ( "5.6" , windows ) ) ;
4242 expect ( req5_6 . version ) . toBe ( "16" ) ;
4343 expect ( req5_6 . components ) . toContain (
4444 "Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
@@ -50,21 +50,21 @@ describe("visual studio resolver", () => {
5050
5151 it ( "adds latest sdk for release newer than or equal to build 17763" , async ( ) => {
5252 jest . spyOn ( os , "release" ) . mockReturnValue ( "10.0.17763" ) ;
53- const req17763 = vs . vsRequirement ( swiftPackage ( "5.3" , windows ) ) ;
53+ const req17763 = vs . vsRequirement ( await getPackage ( "5.3" , windows ) ) ;
5454 expect ( req17763 . components ) . toContain (
5555 "Microsoft.VisualStudio.Component.Windows10SDK.17763"
5656 ) ;
5757
5858 jest . spyOn ( os , "release" ) . mockReturnValue ( "10.0.18363" ) ;
59- const req18363 = vs . vsRequirement ( swiftPackage ( "5.3" , windows ) ) ;
59+ const req18363 = vs . vsRequirement ( await getPackage ( "5.3" , windows ) ) ;
6060 expect ( req18363 . components ) . toContain (
6161 "Microsoft.VisualStudio.Component.Windows10SDK.18363"
6262 ) ;
6363 } ) ;
6464
6565 it ( "adds recommended sdk for release older than build 17763" , async ( ) => {
6666 jest . spyOn ( os , "release" ) . mockReturnValue ( "10.0.16299" ) ;
67- const req16299 = vs . vsRequirement ( swiftPackage ( "5.3" , windows ) ) ;
67+ const req16299 = vs . vsRequirement ( await getPackage ( "5.3" , windows ) ) ;
6868 expect ( req16299 . components ) . toContain (
6969 "Microsoft.VisualStudio.Component.Windows10SDK.17763"
7070 ) ;
0 commit comments