@@ -2,7 +2,7 @@ import { match, restore, SinonStubbedInstance, stub } from 'sinon';
22import * as core from '@actions/core' ;
33import * as tc from '@actions/tool-cache' ;
44import * as exec from '@actions/exec' ;
5- import * as utils from '../src/utils ' ;
5+ import * as io from '@actions/io ' ;
66import installNativeClient from '../src/install-native-client' ;
77import { expect , use } from 'chai' ;
88import sinonChai from 'sinon-chai' ;
@@ -12,7 +12,7 @@ describe('install-native-client', () => {
1212 // let coreStub: SinonStubbedInstance<typeof core>;
1313 let tcStub : SinonStubbedInstance < typeof tc > ;
1414 let execStub : SinonStubbedInstance < typeof exec > ;
15- let utilsStub : SinonStubbedInstance < typeof utils > ;
15+ let ioStub : SinonStubbedInstance < typeof io > ;
1616 let arch : PropertyDescriptor ;
1717 beforeEach ( 'stub deps' , ( ) => {
1818 stub ( core ) ;
@@ -21,8 +21,8 @@ describe('install-native-client', () => {
2121 tcStub . find . returns ( '' ) ;
2222 execStub = stub ( exec ) ;
2323 execStub . exec . resolves ( ) ;
24- utilsStub = stub ( utils ) ;
25- utilsStub . downloadTool . resolves ( 'c:/tmp/downloads' ) ;
24+ ioStub = stub ( io ) ;
25+ ioStub . mv . resolves ( ) ;
2626 } ) ;
2727 afterEach ( 'restore stubs' , ( ) => {
2828 Object . defineProperty ( process , 'arch' , arch ) ;
@@ -31,17 +31,17 @@ describe('install-native-client', () => {
3131 describe ( '.installNativeClient()' , ( ) => {
3232 it ( 'throws for bad version' , async ( ) => {
3333 try {
34- await installNativeClient ( 10 ) ;
34+ await installNativeClient ( '10' ) ;
3535 } catch ( e ) {
36- expect ( e ) . to . have . property ( 'message' , 'Unsupported Native Client version, only 11 is valid .' ) ;
36+ expect ( e ) . to . have . property ( 'message' , 'Invalid native client version supplied 10. Must be one of 11 .' ) ;
3737 return ;
3838 }
3939 expect . fail ( 'expected to throw' ) ;
4040 } ) ;
4141 it ( 'installs from cache' , async ( ) => {
4242 tcStub . find . returns ( 'C:/tmp/' ) ;
43- await installNativeClient ( 11 ) ;
44- expect ( utilsStub . downloadTool ) . to . have . callCount ( 0 ) ;
43+ await installNativeClient ( '11' ) ;
44+ expect ( tcStub . downloadTool ) . to . have . callCount ( 0 ) ;
4545 expect ( execStub . exec ) . to . have . been . calledOnceWith ( 'msiexec' , match . array , {
4646 windowsVerbatimArguments : true ,
4747 } ) ;
@@ -52,8 +52,9 @@ describe('install-native-client', () => {
5252 value : 'x64' ,
5353 } ) ;
5454 tcStub . cacheFile . resolves ( 'C:/tmp/cache/' ) ;
55- await installNativeClient ( 11 ) ;
56- expect ( utilsStub . downloadTool ) . to . have . been . calledOnceWith ( 'https://download.microsoft.com/download/B/E/D/BED73AAC-3C8A-43F5-AF4F-EB4FEA6C8F3A/ENU/x64/sqlncli.msi' ) ;
55+ tcStub . downloadTool . resolves ( 'C:/tmp/downloads' ) ;
56+ await installNativeClient ( '11' ) ;
57+ expect ( tcStub . downloadTool ) . to . have . been . calledOnceWith ( 'https://download.microsoft.com/download/B/E/D/BED73AAC-3C8A-43F5-AF4F-EB4FEA6C8F3A/ENU/x64/sqlncli.msi' ) ;
5758 expect ( tcStub . cacheFile ) . to . have . callCount ( 1 ) ;
5859 expect ( execStub . exec ) . to . have . been . calledOnceWith ( 'msiexec' , match . array , {
5960 windowsVerbatimArguments : true ,
@@ -65,8 +66,9 @@ describe('install-native-client', () => {
6566 value : 'x32' ,
6667 } ) ;
6768 tcStub . cacheFile . resolves ( 'C:/tmp/cache/' ) ;
68- await installNativeClient ( 11 ) ;
69- expect ( utilsStub . downloadTool ) . to . have . been . calledOnceWith ( 'https://download.microsoft.com/download/B/E/D/BED73AAC-3C8A-43F5-AF4F-EB4FEA6C8F3A/ENU/x86/sqlncli.msi' ) ;
69+ tcStub . downloadTool . resolves ( 'C:/tmp/downloads' ) ;
70+ await installNativeClient ( '11' ) ;
71+ expect ( tcStub . downloadTool ) . to . have . been . calledOnceWith ( 'https://download.microsoft.com/download/B/E/D/BED73AAC-3C8A-43F5-AF4F-EB4FEA6C8F3A/ENU/x86/sqlncli.msi' ) ;
7072 expect ( tcStub . cacheFile ) . to . have . callCount ( 1 ) ;
7173 expect ( execStub . exec ) . to . have . been . calledOnceWith ( 'msiexec' , match . array , {
7274 windowsVerbatimArguments : true ,
0 commit comments