@moreapp/common-nodejs 0.7.6 → 0.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/utils.js CHANGED
@@ -34,7 +34,7 @@ function currentTraceId() {
34
34
  exports.currentTraceId = currentTraceId;
35
35
  const emailAddressMaxLength = 254; // https://stackoverflow.com/a/574698
36
36
  const emailAddressLocalPattern = /^.+$/;
37
- const emailAddressDomainPattern = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$/;
37
+ const emailAddressDomainPattern = /^(?:[A-z0-9À-ž](?:[A-z0-9À-ž-]{0,61}[A-z0-9À-ž])?\.)+[A-z0-9À-ž][A-z0-9À-ž-]{0,61}[A-z0-9]$/;
38
38
  // There are many regex patterns to validate email addresses, but they all have flaws and cannot 100% correctly verify
39
39
  // every possible email address. For us, it's more important to avoid the majority of typo's instead of catching every
40
40
  // invalid email address. We let our email provider handle and false positives (either by their validation or the fact
@@ -43,18 +43,19 @@ describe("isValidEmail", () => {
43
43
  test("Subdomain", () => expect((0, utils_1.isValidEmail)("a@sub.domain.dev")).toBeTruthy());
44
44
  test("Subdomain with a dash", () => expect((0, utils_1.isValidEmail)("a@sub.dom-ain.dev")).toBeTruthy());
45
45
  test("Long TLD", () => expect((0, utils_1.isValidEmail)("a@b.business")).toBeTruthy());
46
- test("Diacritics", () => expect((0, utils_1.isValidEmail)("ẞçäöü@moreapp.dev")).toBeTruthy());
46
+ test("Diacritics", () => expect((0, utils_1.isValidEmail)("ẞçäöü@möręæppß.dev")).toBeTruthy());
47
+ test("Casing", () => expect((0, utils_1.isValidEmail)("TØmÂs@mŒREÄPp.cOm")).toBeTruthy());
47
48
  });
48
49
  describe("Invalid email addresses", () => {
49
50
  test("Missing '@' character and domain", () => expect((0, utils_1.isValidEmail)("john")).toBeFalsy());
50
- test("// Multiple '@' characters", () => expect((0, utils_1.isValidEmail)("a@b@moreapp.dev")).toBeFalsy());
51
- test("// Empty", () => expect((0, utils_1.isValidEmail)("")).toBeFalsy());
52
- test("// Whitespace before/after", () => expect((0, utils_1.isValidEmail)(" a@moreapp.dev ")).toBeFalsy());
53
- test("// Newlines, tabs, ..., before/after", () => expect((0, utils_1.isValidEmail)("\n \ta@moreapp.dev\n ")).toBeFalsy());
54
- test("// Missing '@' character", () => expect((0, utils_1.isValidEmail)("ab.com")).toBeFalsy());
55
- test("// Double dot in domain", () => expect((0, utils_1.isValidEmail)("a@moreapp..com")).toBeFalsy());
56
- test("// Too short TLD", () => expect((0, utils_1.isValidEmail)("a@b.c")).toBeFalsy());
57
- test("// Missing local part", () => expect((0, utils_1.isValidEmail)("@moreapp.dev")).toBeFalsy());
58
- test("// Too long", () => expect((0, utils_1.isValidEmail)("abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-@moreapp.dev")).toBeFalsy());
51
+ test("Multiple '@' characters", () => expect((0, utils_1.isValidEmail)("a@b@moreapp.dev")).toBeFalsy());
52
+ test("Empty", () => expect((0, utils_1.isValidEmail)("")).toBeFalsy());
53
+ test("Whitespace before/after", () => expect((0, utils_1.isValidEmail)(" a@moreapp.dev ")).toBeFalsy());
54
+ test("Newlines, tabs, ..., before/after", () => expect((0, utils_1.isValidEmail)("\n \ta@moreapp.dev\n ")).toBeFalsy());
55
+ test("Missing '@' character", () => expect((0, utils_1.isValidEmail)("ab.com")).toBeFalsy());
56
+ test("Double dot in domain", () => expect((0, utils_1.isValidEmail)("a@moreapp..com")).toBeFalsy());
57
+ test("Too short TLD", () => expect((0, utils_1.isValidEmail)("a@b.c")).toBeFalsy());
58
+ test("Missing local part", () => expect((0, utils_1.isValidEmail)("@moreapp.dev")).toBeFalsy());
59
+ test("Too long", () => expect((0, utils_1.isValidEmail)("abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-abcdefghijklmnopqrstuvwxyz-@moreapp.dev")).toBeFalsy());
59
60
  });
60
61
  });
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@moreapp/common-nodejs",
3
- "version": "0.7.6",
3
+ "version": "0.7.10",
4
4
  "license": "UNLICENSED",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
- "test": "jest",
9
+ "test": "jest --detectOpenHandles",
10
+ "test:workflow": "yarn test --coverage",
10
11
  "prettier": "prettier './**/*.{ts,json,yaml,md,}'",
11
12
  "format:check": "yarn prettier --check",
12
13
  "format:fix": "yarn prettier --write",
@@ -49,7 +50,6 @@
49
50
  "husky": "8.0.3",
50
51
  "jest": "29.6.4",
51
52
  "jest-mock-extended": "3.0.5",
52
- "jest-sonar-reporter": "2.0.0",
53
53
  "lint-staged": "13.3.0",
54
54
  "nock": "13.3.8",
55
55
  "prettier": "2.8.8",