diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f76a6be --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: Running Code Coverage + +on: [pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Set up Node.js 16.x + uses: actions/setup-node@v2 + with: + node-version: 16.x + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm run test + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN}} + diff --git a/README.md b/README.md index 95a18a6..6991921 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![npm version](https://img.shields.io/npm/v/mm-mobile-tools.svg?style=flat-square)](https://www.npmjs.org/package/mm-mobile-tools) ![Build status](https://github.com/lwinmoehein/MM-Mobiile-Tools-JS/actions/workflows/cd.yml/badge.svg) -[![code coverage](https://img.shields.io/coveralls/mzabriskie/mm-mobile-tools.svg?style=flat-square)](https://coveralls.io/r/lwinmoehein/mm-mobile-tools) +[![codecov](https://codecov.io/gh/lwinmoehein/MM-Mobile-Tools-JS/graph/badge.svg?token=YVS9A98YJQ)](https://codecov.io/gh/lwinmoehein/MM-Mobile-Tools-JS) [![npm downloads](https://img.shields.io/npm/dm/mm-mobile-tools.svg?style=flat-square)](https://npm-stat.com/charts.html?package=mm-mobile-tools) diff --git a/__tests__/GetOperator.test.ts b/__tests__/GetOperator.test.ts index 073cbeb..cb36ce2 100644 --- a/__tests__/GetOperator.test.ts +++ b/__tests__/GetOperator.test.ts @@ -17,4 +17,8 @@ describe('Phone Number validation checks', () => { test('Should return true for valid MECTel phone number', () => { expect(mmphone.getOperator("09301173991")).toBe(Operator.MECTEL); }); + test('Should return true for invalid phone number', () => { + expect(mmphone.getOperator("0911223344881")).toBe(Operator.INVALID); + }); + });