Add max-parallelism to test workflow

and add more tests for isPositiveInteger
function
This commit is contained in:
Riccardo Rigutini 2023-11-10 17:46:56 +00:00 committed by GitHub
parent 4245b3de99
commit da40211525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 0 deletions

View File

@ -38,6 +38,7 @@ jobs:
files: '**/*.txt'
replacement-text: '1.0.2'
exclude: '**/*.check.txt'
max-parallelism: '1'
- name: Replace in Files - replace using special characters
uses: ./
@ -91,6 +92,26 @@ jobs:
encoding: 'invalid'
exclude: '**/*.check.txt'
- name: Replace in Files - error on invalid max-parallelism (invalid number)
uses: ./
continue-on-error: true
with:
search-text: 'foo'
files: '**/*.txt'
replacement-text: 'bar'
exclude: '**/*.check.txt'
max-parallelism: '-1'
- name: Replace in Files - error on invalid max-parallelism (invalid string)
uses: ./
continue-on-error: true
with:
search-text: 'foo'
files: '**/*.txt'
replacement-text: 'bar'
exclude: '**/*.check.txt'
max-parallelism: 'invalid'
- name: Verify changes
run: |
echo " > Actual - test1.txt"

View File

@ -29,6 +29,22 @@ describe('isPositiveInteger', () => {
it('should return false for non-numeric strings', () => {
expect(isPositiveInteger('abc')).toBe(false);
});
it('should return false for empty strings', () => {
expect(isPositiveInteger('')).toBe(false);
});
it('should return false for whitespace strings', () => {
expect(isPositiveInteger(' ')).toBe(false);
});
it('should return false for null', () => {
expect(isPositiveInteger(null as any)).toBe(false);
});
it('should return false for undefined', () => {
expect(isPositiveInteger(undefined as any)).toBe(false);
});
});
describe('isValidEncoding', () => {