11import test from "ava" ;
22import sinon from "sinon" ;
33
4- import { getActionsEnv } from "../actions-util" ;
4+ import { ActionsEnv } from "../actions-util" ;
55import { Feature } from "../feature-flags" ;
66import { RepositoryPropertyName } from "../feature-flags/properties" ;
77import { callee } from "../testing-utils" ;
@@ -22,32 +22,26 @@ const expectedRepositoryPropertyResult: ComputedInput = {
2222 value : "repo-property-input-value" ,
2323} ;
2424
25- function stubGetToolsInput ( ) {
26- const actions = getActionsEnv ( ) ;
25+ function stubGetToolsInput ( actions : ActionsEnv ) {
2726 sinon
2827 . stub ( actions , "getOptionalInput" )
2928 . withArgs ( InputName . Tools )
3029 . returns ( expectedWorkflowResult . value ) ;
31- return actions ;
3230}
3331
3432const workflowLogMessage = `Using ${ InputName . Tools } input from workflow:` ;
3533
3634test ( "getToolsInput - returns workflow input if available" , async ( t ) => {
37- const actions = stubGetToolsInput ( ) ;
38-
3935 await callee ( getToolsInput )
40- . withActions ( actions )
36+ . withActions ( stubGetToolsInput )
4137 . withArgs ( { } )
4238 . logs ( t , workflowLogMessage )
4339 . passes ( t . deepEqual , expectedWorkflowResult ) ;
4440} ) ;
4541
4642test ( "getToolsInput - returns repository property value if enforced" , async ( t ) => {
47- const actions = stubGetToolsInput ( ) ;
48-
4943 const target = callee ( getToolsInput )
50- . withActions ( actions )
44+ . withActions ( stubGetToolsInput )
5145 . withArgs ( {
5246 [ RepositoryPropertyName . TOOLS ] : `!${ expectedRepositoryPropertyResult . value } ` ,
5347 } ) ;
@@ -65,10 +59,8 @@ test("getToolsInput - returns repository property value if enforced", async (t)
6559} ) ;
6660
6761test ( "getToolsInput - prefers workflow input" , async ( t ) => {
68- const actions = stubGetToolsInput ( ) ;
69-
7062 const target = callee ( getToolsInput )
71- . withActions ( actions )
63+ . withActions ( stubGetToolsInput )
7264 . withArgs ( {
7365 [ RepositoryPropertyName . TOOLS ] : expectedRepositoryPropertyResult . value ,
7466 } ) ;
0 commit comments