1
1
import os from "os" ;
2
2
import * as path from "path" ;
3
3
import * as vs from "../src/visual-studio" ;
4
- import { swiftPackage } from "../src/swift-versions " ;
4
+ import { getPackage } from "../src/swift-package " ;
5
5
import { OS , System } from "../src/os" ;
6
6
7
7
jest . mock ( "fs" , ( ) => {
@@ -29,7 +29,7 @@ describe("visual studio resolver", () => {
29
29
it ( "fetches visual studio requirement for swift version" , async ( ) => {
30
30
jest . spyOn ( os , "release" ) . mockReturnValue ( "10.0.17763" ) ;
31
31
32
- const req5_3 = vs . vsRequirement ( swiftPackage ( "5.3" , windows ) ) ;
32
+ const req5_3 = vs . vsRequirement ( await getPackage ( "5.3" , windows ) ) ;
33
33
expect ( req5_3 . version ) . toBe ( "16" ) ;
34
34
expect ( req5_3 . components ) . toContain (
35
35
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
@@ -38,7 +38,7 @@ describe("visual studio resolver", () => {
38
38
"Microsoft.VisualStudio.Component.Windows10SDK.17763"
39
39
) ;
40
40
41
- const req5_6 = vs . vsRequirement ( swiftPackage ( "5.6" , windows ) ) ;
41
+ const req5_6 = vs . vsRequirement ( await getPackage ( "5.6" , windows ) ) ;
42
42
expect ( req5_6 . version ) . toBe ( "16" ) ;
43
43
expect ( req5_6 . components ) . toContain (
44
44
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
@@ -50,21 +50,21 @@ describe("visual studio resolver", () => {
50
50
51
51
it ( "adds latest sdk for release newer than or equal to build 17763" , async ( ) => {
52
52
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 ) ) ;
54
54
expect ( req17763 . components ) . toContain (
55
55
"Microsoft.VisualStudio.Component.Windows10SDK.17763"
56
56
) ;
57
57
58
58
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 ) ) ;
60
60
expect ( req18363 . components ) . toContain (
61
61
"Microsoft.VisualStudio.Component.Windows10SDK.18363"
62
62
) ;
63
63
} ) ;
64
64
65
65
it ( "adds recommended sdk for release older than build 17763" , async ( ) => {
66
66
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 ) ) ;
68
68
expect ( req16299 . components ) . toContain (
69
69
"Microsoft.VisualStudio.Component.Windows10SDK.17763"
70
70
) ;
0 commit comments