cosmos-explorer/src/Utils/StringUtils.test.ts

31 lines
1.1 KiB
TypeScript
Raw Normal View History

import * as StringUtils from "./StringUtils";
2021-01-20 15:15:01 +00:00
describe("StringUtils", () => {
describe("stripSpacesFromString()", () => {
it("should strip all spaces from input string", () => {
const transformedString: string = StringUtils.stripSpacesFromString("a b c");
expect(transformedString).toBe("abc");
});
it("should return original string if input string has no spaces", () => {
const transformedString: string = StringUtils.stripSpacesFromString("abc");
expect(transformedString).toBe("abc");
});
it("should return undefined if input is undefined", () => {
const transformedString: string = StringUtils.stripSpacesFromString(undefined);
expect(transformedString).toBeUndefined();
2021-01-20 15:15:01 +00:00
});
it("should return undefined if input is undefiend", () => {
const transformedString: string = StringUtils.stripSpacesFromString(undefined);
expect(transformedString).toBe(undefined);
});
it("should return empty string if input is an empty string", () => {
const transformedString: string = StringUtils.stripSpacesFromString("");
expect(transformedString).toBe("");
});
});
});