Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows WebClient token to be undefined #499

Merged
merged 7 commits into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
adds typings-tester, and failing test for WebClient without token
  • Loading branch information
aoberoi committed Mar 14, 2018
commit e6580bb59164264664f740869a3eb17534764a3e
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@
"precommit": "lint-staged",
"prepush": "npm run build",
"lint": "tslint --project .",
"test": "npm run test:spec",
"test": "npm run test:spec && npm run test:integration",
"test:spec": "nyc mocha --opts src/mocha.opts src/*.spec.js src/**/*.spec.js",
"test:integration": "nyc mocha --opts test/mocha.opts test/typescript/test.ts",
"coverage": "codecov",
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage ./.nyc_output",
Expand Down Expand Up @@ -90,6 +91,7 @@
"ts-node": "^4.1.0",
"tslint": "^5.9.1",
"tslint-config-airbnb": "^5.5.0",
"typescript": "^2.7.1"
"typescript": "^2.7.1",
"typings-tester": "^0.3.1"
}
}
11 changes: 11 additions & 0 deletions test/typescript/sources/webclient-no-token.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

import { WebClient } from '../../../dist';

const web = new WebClient();

web.oauth.access({
client_id: 'CLIENT_ID',
client_secret: 'CLIENT_SECRET',
code: 'CODE',
redirect_uri: 'REDIRECT_URI',
});
9 changes: 9 additions & 0 deletions test/typescript/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'mocha';
import { check, checkDirectory } from 'typings-tester';

describe('typescript typings tests', () => {
it('should allow WebClient to work without a token', () => {
check([`${__dirname}/sources/webclient-no-token.ts`], `${__dirname}/tsconfig-strict.json`);
});
});

13 changes: 13 additions & 0 deletions test/typescript/tsconfig-strict.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"sourceMap": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node"
}
}