Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sundowndev
GitHub Repository: sundowndev/phoneinfoga
Path: blob/master/web/client/tests/unit/utils.spec.ts
994 views
1
import { formatNumber, isValid } from "../../src/utils";
2
3
describe("src/utils", () => {
4
describe("#formatNumber", () => {
5
it("should format phone number", () => {
6
expect(formatNumber("+1 (555) 444-3333")).toBe("15554443333");
7
expect(formatNumber("1/(555)_444-3333")).toBe("15554443333");
8
});
9
});
10
11
describe("#isValid", () => {
12
it("should check if number is valid", () => {
13
expect(isValid("+1/(555)_444-3333")).toBe(true);
14
expect(isValid("1 555 4443333")).toBe(true);
15
expect(isValid("this1 555 4443333")).toBe(false);
16
});
17
});
18
});
19
20