1- // Copyright 2020 The MathWorks, Inc.
1+ // Copyright 2020-2022 The MathWorks, Inc.
22
33import * as core from "@actions/core" ;
44import * as install from "./install" ;
@@ -21,7 +21,8 @@ describe("install procedure", () => {
2121 // they can be held static for these unit tests
2222 const platform = "linux" ;
2323 const release = "latest" ;
24- const doInstall = ( ) => install . install ( platform , release ) ;
24+ const skipActivationFlag = ""
25+ const doInstall = ( ) => install . install ( platform , release , skipActivationFlag ) ;
2526
2627 beforeEach ( ( ) => {
2728 downloadAndRunScriptMock = script . downloadAndRunScript as jest . Mock ;
@@ -32,15 +33,19 @@ describe("install procedure", () => {
3233 ( core . group as jest . Mock ) . mockImplementation ( async ( _ , func ) => {
3334 return func ( ) ;
3435 } ) ;
36+ ( core . addPath as jest . Mock ) . mockImplementation ( async ( _ ) => {
37+ return ;
38+ } ) ;
3539 } ) ;
3640
3741 it ( "ideally works" , async ( ) => {
3842 downloadAndRunScriptMock . mockResolvedValue ( undefined ) ;
3943 addToPathMock . mockResolvedValue ( undefined ) ;
4044
4145 await expect ( doInstall ( ) ) . resolves . toBeUndefined ( ) ;
42- expect ( downloadAndRunScriptMock ) . toHaveBeenCalledTimes ( 2 ) ;
46+ expect ( downloadAndRunScriptMock ) . toHaveBeenCalledTimes ( 3 ) ;
4347 expect ( addToPathMock ) . toHaveBeenCalledTimes ( 1 ) ;
48+ expect ( core . addPath ) . toHaveBeenCalledTimes ( 1 ) ;
4449 } ) ;
4550
4651 it ( "rejects when the download fails" , async ( ) => {
@@ -76,8 +81,8 @@ describe("install procedure", () => {
7681 downloadAndRunScriptMock . mockResolvedValue ( undefined ) ;
7782 addToPathMock . mockResolvedValue ( undefined ) ;
7883
79- await expect ( install . install ( os , release ) ) . resolves . toBeUndefined ( ) ;
80- expect ( downloadAndRunScriptMock ) . toHaveBeenCalledTimes ( 1 ) ;
84+ await expect ( install . install ( os , release , skipActivationFlag ) ) . resolves . toBeUndefined ( ) ;
85+ expect ( downloadAndRunScriptMock ) . toHaveBeenCalledTimes ( 2 ) ;
8186 expect ( addToPathMock ) . toHaveBeenCalledTimes ( 1 ) ;
8287 } ) ;
8388 } ) ;
0 commit comments