extracted the asset name alignment to utils, added unit tests

This commit is contained in:
Eugen Dukhin 2024-09-27 10:49:58 +02:00
parent c7857c88c0
commit b8b7280f3a
3 changed files with 21 additions and 2 deletions

View file

@ -6,6 +6,7 @@ import {
parseInputFiles,
unmatchedPatterns,
uploadUrl,
alignAssetName
} from "../src/util";
import * as assert from "assert";
@ -368,4 +369,18 @@ describe("util", () => {
);
});
});
describe('replaceSpacesWithDots', () => {
it('replaces all spaces with dots', () => {
expect(alignAssetName("John Doe.bla")).toBe("John.Doe.bla");
});
it('handles names with multiple spaces', () => {
expect(alignAssetName("John William Doe.bla")).toBe("John.William.Doe.bla");
});
it('returns the same string if there are no spaces', () => {
expect(alignAssetName("JohnDoe")).toBe("JohnDoe");
});
});
});