@@ -2,15 +2,20 @@ import test from "ava";
22import sinon from "sinon" ;
33
44import { RepositoryPropertyName } from "../feature-flags/properties" ;
5- import { getTestActionsEnv , setupTests } from "../testing-utils" ;
5+ import {
6+ getTestActionsEnv ,
7+ RecordingLogger ,
8+ setupTests ,
9+ } from "../testing-utils" ;
610
711import { getConfigFileInput } from "./file" ;
812
913setupTests ( test ) ;
1014
1115test ( "getConfigFileInput returns undefined by default" , async ( t ) => {
16+ const logger = new RecordingLogger ( ) ;
1217 const actionsEnv = getTestActionsEnv ( ) ;
13- const result = getConfigFileInput ( actionsEnv , { } ) ;
18+ const result = getConfigFileInput ( logger , actionsEnv , { } ) ;
1419 t . is ( result , undefined ) ;
1520} ) ;
1621
@@ -19,6 +24,7 @@ const repositoryProperties = {
1924} ;
2025
2126test ( "getConfigFileInput returns input value" , async ( t ) => {
27+ const logger = new RecordingLogger ( ) ;
2228 const actionsEnv = getTestActionsEnv ( ) ;
2329 const testInput = "/some/path" ;
2430 sinon
@@ -28,14 +34,25 @@ test("getConfigFileInput returns input value", async (t) => {
2834
2935 // Even though both an input and repository property are configured,
3036 // we prefer the direct input to the Action.
31- const result = getConfigFileInput ( actionsEnv , repositoryProperties ) ;
37+ const result = getConfigFileInput ( logger , actionsEnv , repositoryProperties ) ;
3238 t . is ( result , testInput ) ;
39+
40+ // Check for the expected log message.
41+ t . true ( logger . hasMessage ( "Using configuration file input from workflow" ) ) ;
3342} ) ;
3443
3544test ( "getConfigFileInput returns repository property value" , async ( t ) => {
45+ const logger = new RecordingLogger ( ) ;
3646 const actionsEnv = getTestActionsEnv ( ) ;
3747
3848 // Since there is no direct input, we should use the repository property.
39- const result = getConfigFileInput ( actionsEnv , repositoryProperties ) ;
49+ const result = getConfigFileInput ( logger , actionsEnv , repositoryProperties ) ;
4050 t . is ( result , repositoryProperties [ RepositoryPropertyName . CONFIG_FILE ] ) ;
51+
52+ // Check for the expected log message.
53+ t . true (
54+ logger . hasMessage (
55+ "Using configuration file input from repository property" ,
56+ ) ,
57+ ) ;
4158} ) ;
0 commit comments