Update test files

This commit is contained in:
Tom Hu
2021-01-02 18:02:41 -05:00
parent e16afe2276
commit 7a024964de
6 changed files with 9 additions and 41 deletions

View File

@@ -10,18 +10,17 @@ jobs:
run: npm install run: npm install
- name: Run tests and collect coverage - name: Run tests and collect coverage
run: yarn run test-all run: yarn run test-all
- name: Upload coverage to Codecov - name: Upload coverage to Codecov (demo)
uses: ./ uses: ./
with: with:
files: ./coverage/calculator/coverage-final.json,./coverage/index/coverage-final.json files: ./coverage/calculator/coverage-final.json,./coverage/coverage/coverage-final.json
file: ./coverage/coverage-final.json file: ./coverage/coverage-final.json
flags: unittest flags: demo
name: codecov-1 name: codecov-1
- name: Upload coverage to Codecov (verbose) - name: Upload coverage to Codecov (script)
uses: ./ uses: ./
with: with:
files: ./coverage/calculator/coverage-final.json,./coverage/index/coverage-final.json files: ./coverage/script/coverage-final.json
file: ./coverage/coverage-final.json flags: script
flags: unittest
name: codecov-1 name: codecov-1
verbose: true verbose: true

View File

@@ -5,8 +5,9 @@
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "jest --coverage", "test": "jest --coverage",
"test-calculator": "jest --testPathPattern=src/calculator/ --coverage --coverageDirectory=coverage/calculator", "test-calculator": "jest --testPathPattern=demo/calculator/ --coverage --coverageDirectory=coverage/calculator",
"test-index": "jest --testPathPattern=src/index --coverage --coverageDirectory=coverage/index", "test-coverage": "jest --testPathPattern=demo/coverage --coverage --coverageDirectory=coverage/coverage",
"test-script": "jest --testPathPattern=src --coverage --coverageDirectory=coverage/script",
"test-all": "yarn run test && yarn run test-calculator && yarn run test-index && eslint", "test-all": "yarn run test && yarn run test-calculator && yarn run test-index && eslint",
"build": "ncc build src/index.ts" "build": "ncc build src/index.ts"
}, },

View File

@@ -1,11 +0,0 @@
import Index from "./index";
test('test uncovered if', () => {
const indexObj = new Index();
expect(indexObj.uncovered_if()).toEqual(false);
});
test('fully covered', () => {
const indexObj = new Index();
expect(indexObj.fully_covered()).toEqual(true);
});

View File

@@ -1,21 +0,0 @@
export default class Index {
//This function is tested and part of it is uncovered
uncovered_if = (a = true) => {
if (a == true) {
return false
} else {
return true
}
}
//This function will be fully covered
fully_covered = () => {
return true
}
//This function will not be tested by unit tests
uncovered = () => {
return true
}
}