Skip to content

Commit

Permalink
node create npm package
Browse files Browse the repository at this point in the history
  • Loading branch information
ajibade3210 committed May 25, 2024
1 parent 71e243e commit f9484e6
Show file tree
Hide file tree
Showing 10 changed files with 7,952 additions and 0 deletions.
52 changes: 52 additions & 0 deletions nodejs/node-create-npm-pacakage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# validate-npm-pc

## 1.0.9

### Patch Changes

- ec9d61a: Module fix

## 1.0.8

### Patch Changes

- 4371fc0: test/publish-process-another-update

## 1.0.7

### Patch Changes

- 773c804: publish lastest

## 1.0.6

### Patch Changes

- 8aed3fe: publish new

## 1.0.5

### Patch Changes

- 46c9206: add type to jest
- e4c2114: add package type
- f3fef1a: rearrange logic

## 1.0.4

### Patch Changes

- ee3a7db: test publish process

## 1.0.3

### Patch Changes

- 4bde7a0: add new social link
- f69d51c: update social links

## 1.0.2

### Patch Changes

- ad1aa77: Adding new social link
1 change: 1 addition & 0 deletions nodejs/node-create-npm-pacakage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# validate-npm-pc
43 changes: 43 additions & 0 deletions nodejs/node-create-npm-pacakage/__tests__/validate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { validMobileNo, validEmail, validSocial } from "../src/index";

describe("validMobileNo", () => {
test("Valid mobile number with + sign and 15 digits", () => {
expect(validMobileNo("+234706469321234")).toBe(true);
});

test("Invalid mobile number without + sign", () => {
expect(validMobileNo("234706469321234")).toBe(false);
});

test("Invalid mobile number with more than 15 digits", () => {
expect(validMobileNo("+23470646932123456")).toBe(false);
});
});

describe("validEmail", () => {
test("Valid email address", () => {
expect(validEmail("[email protected]")).toBe(true);
});

test('Invalid email address without "@" symbol', () => {
expect(validEmail("examplemail.com")).toBe(false);
});

test("Invalid email address without domain", () => {
expect(validEmail("example@mail")).toBe(false);
});
});

describe("validSocial", () => {
test("Valid Facebook URL", () => {
expect(validSocial("https://www.facebook.com/example")).toBe(true);
});

test("Valid Twitter URL", () => {
expect(validSocial("https://www.twitter.com/example")).toBe(true);
});

test("Invalid URL", () => {
expect(validSocial("https://www.invalid.com/example")).toBe(false);
});
});
6 changes: 6 additions & 0 deletions nodejs/node-create-npm-pacakage/jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const config = {
moduleFileExtensions: ["ts", "tsx", "js"],
preset: "ts-jest",
};

export default config;
Loading

0 comments on commit f9484e6

Please sign in to comment.