Skip to content

Commit

Permalink
Merge pull request #32 from multinet-app/test-overhaul
Browse files Browse the repository at this point in the history
Overhaul the testing system
  • Loading branch information
waxlamp authored May 10, 2021
2 parents f64b22a + f6ae838 commit cc1d911
Show file tree
Hide file tree
Showing 7 changed files with 3,480 additions and 564 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
- name: Run linting test
run: yarn lint

- name: Run unit tests
run: yarn test

- name: Create a production build
run: yarn build

Expand Down
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
roots: [
"<rootDir>"
],
testMatch: [
"**/test/**/*\\.test\\.(ts|tsx|js)",
],
transform: {
"^.+\\.(ts|tsx)$": "ts-jest"
},
}
15 changes: 6 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,20 @@
"build": "tsc",
"lint": "tslint -p tsconfig.json -c tslint.json",
"lint:fix": "tslint --force -p tsconfig.json -c tslint.json",
"test:server:up": "cd .. && PIPENV_DONT_LOAD_ENV=1 pipenv run test-server-up",
"test:server:down": "cd .. && PIPENV_DONT_LOAD_ENV=1 pipenv run test-server-down",
"test:server:clean": "cd .. && PIPENV_DONT_LOAD_ENV=1 pipenv run test-server-clean",
"test:server:restart": "yarn test:server:down; yarn test:server:clean && yarn test:server:up",
"test": "tape -r esm test/**/*.test.js | tap-spec"
"test": "jest"
},
"author": "Kitware, Inc.",
"license": "Apache-2.0",
"dependencies": {
"axios": "^0.19.0"
"axios": "^0.19.0",
"ts-jest": "^26.5.4"
},
"devDependencies": {
"@types/jest": "^26.0.21",
"esm": "^3.2.25",
"tap-spec": "^5.0.0",
"tape": "^4.11.0",
"jest": "^26.6.3",
"tslib": "^1.10.0",
"tslint": "^5.20.0",
"typescript": "^3.6.3"
"typescript": "^4.2.3"
}
}
248 changes: 0 additions & 248 deletions test/multinet.test.js

This file was deleted.

13 changes: 13 additions & 0 deletions test/multinet.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { multinetApi } from '../src/index';
import { AxiosError } from 'axios';

const badApi = multinetApi('http://example.com');

test('bad api', async () => {
expect(badApi).toEqual(expect.anything());

// The "bad api" object should fail when invoked.
await expect(badApi.workspaces())
.rejects
.toHaveProperty('isAxiosError', true);
});
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"sourceMap": true,
"baseUrl": ".",
"types": [
"jest"
],
"paths": {
"@/*": [
Expand All @@ -35,8 +36,8 @@
},
"include": [
"src/**/*.ts",
"tests/**/*.ts",
"tests/**/*.tsx"
"test/**/*.ts",
"test/**/*.tsx"
],
"exclude": [
"node_modules"
Expand Down
Loading

0 comments on commit cc1d911

Please sign in to comment.