File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export const LOCAL_CONFIG_NAME = 'actor.json';
4949
5050export const LOCAL_CONFIG_PATH = join ( ACTOR_SPECIFICATION_FOLDER , LOCAL_CONFIG_NAME ) ;
5151
52- export const INPUT_FILE_REG_EXP = new RegExp ( `^${ KEY_VALUE_STORE_KEYS . INPUT } \\..* ` ) ;
52+ export const INPUT_FILE_REG_EXP = new RegExp ( `( ^${ KEY_VALUE_STORE_KEYS . INPUT } (?: \\.[^.]+)?$) ` ) ;
5353
5454export const SUPPORTED_NODEJS_VERSION = pkg . engines . node ;
5555
Original file line number Diff line number Diff line change 11import { existsSync , writeFileSync } from 'node:fs' ;
22import { join } from 'node:path' ;
33
4+ import { INPUT_FILE_REG_EXP } from '../../../src/lib/consts.js' ;
45import { execWithLog } from '../../../src/lib/exec.js' ;
56import { ensureFolderExistsSync } from '../../../src/lib/files.js' ;
67import { createActZip , getActorLocalFilePaths } from '../../../src/lib/utils.js' ;
@@ -78,4 +79,22 @@ describe('Utils', () => {
7879 ) ;
7980 } ) ;
8081 } ) ;
82+
83+ describe ( 'input file regex' , ( ) => {
84+ const validFiles = [ 'INPUT' , 'INPUT.json' , 'INPUT.bin' ] ;
85+
86+ const invalidFiles = [ 'INPUT_' , 'INPUT.__metadata__.json' ] ;
87+
88+ validFiles . forEach ( ( file ) => {
89+ it ( `should match ${ file } ` , ( ) => {
90+ expect ( ! ! file . match ( INPUT_FILE_REG_EXP ) ) . toBeTruthy ( ) ;
91+ } ) ;
92+ } ) ;
93+
94+ invalidFiles . forEach ( ( file ) => {
95+ it ( `should not match ${ file } ` , ( ) => {
96+ expect ( ! ! file . match ( INPUT_FILE_REG_EXP ) ) . toBeFalsy ( ) ;
97+ } ) ;
98+ } ) ;
99+ } ) ;
81100} ) ;
You can’t perform that action at this time.
0 commit comments