forked from slackapi/bolt-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from slackapi/master
Bring my fork up to date with upstream
- Loading branch information
Showing
29 changed files
with
484 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# node / npm stuff | ||
/node_modules | ||
/package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Integration Type Checker", | ||
"program": "${workspaceFolder}/node_modules/dtslint/bin/index.js", | ||
"args": [ | ||
"types" | ||
], | ||
"internalConsoleOptions": "openOnSessionStart", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"cwd": "${workspaceFolder}" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "npm test", | ||
"cwd": "${workspaceFolder}", | ||
"runtimeExecutable": "npm", | ||
"runtimeArgs": [ | ||
"run-script", "test" | ||
], | ||
"port": 9229 | ||
|
||
}, | ||
] | ||
} | ||
|
||
/* | ||
[ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Integration Type Checker", | ||
"program": "${workspaceFolder}/node_modules/dtslint/bin/index.js", | ||
"args": [ | ||
"types" | ||
], | ||
"internalConsoleOptions": "openOnSessionStart", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"cwd": "${workspaceFolder}" | ||
}, | ||
] | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## Integration tests | ||
|
||
This directory contains a minimal project used as an environment in which to run integration tests. | ||
|
||
It's important to isolate this test project from the overall project where the package is built in order to eliminate | ||
assumptions. Specifically, the `package.json` and other configuration files in this directory are meant to include | ||
the minimum requirements and nothing more. Here are a few ways this is set up: | ||
|
||
* The `@types/node` dependency is set to a version that corresponds to the lowest supported node version. This enforces | ||
that the distribution should work in projects who have chosen that particular version, since its the most likely to | ||
not have types that we accidentally depend on but shouldn't. | ||
|
||
* The `typescript` development dependency is set to the most modern version of typescript. It's not important to use the | ||
oldest supported version because the `dtslint` tool will run the typechecker result integration tests on each | ||
supported version of TypeScript. It reads the oldest supported version from `types/index.d.ts`. | ||
|
||
* The `tsconfig.json` file is specifically set to the most strict settings as well as the most minimal requirements. | ||
This is specifically chosen to verify that the requirements expressed in the documentation are sufficient and | ||
represent the least amount of configuration needed to get the package working. | ||
|
||
* In `package.json`, the `"private"` key must remain set to `true`. This enforces that this project doesn't get | ||
accidentally published. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "@slack/bolt-integration-tests", | ||
"private": true, | ||
"description": "Integration tests for Bolt", | ||
"author": "Slack Technologies, Inc.", | ||
"license": "MIT", | ||
"scripts": { | ||
"test": "npm run test:typechecker", | ||
"test:typechecker": "dtslint types" | ||
}, | ||
"dependencies": { | ||
"@slack/bolt": "file:..", | ||
"@types/node": "^10.0.0" | ||
}, | ||
"devDependencies": { | ||
"dtslint": "^0.5.4", | ||
"typescript": "^3.7.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// import App, { ActionConstraints } from '../../src/App'; | ||
import { App, MessageAction } from '@slack/bolt'; | ||
|
||
const app = new App({ token: 'TOKEN', signingSecret: 'Signing Secret' }); | ||
|
||
// calling action method with incorrect an type constraint value should not work | ||
// $ExpectError | ||
app.action({ type: 'Something wrong' }, ({ action }) => { | ||
return action; | ||
}); | ||
|
||
/* Not working | ||
// Should error because message_action doesn't have type action_id | ||
// $ Expect Error | ||
app.action({ type: 'message_action', action_id: 'dafasf' }, ({ action }) => { | ||
return action; | ||
}); | ||
*/ | ||
|
||
// Action in listner should be - MessageAction | ||
// $ExpectType void | ||
app.action({ type: 'message_action' }, ({ | ||
action, // $ExpectType MessageAction | ||
}) => { | ||
return action; | ||
}); | ||
|
||
// $ExpectType void | ||
app.action({ type: 'block_actions' }, ({ | ||
action, // $ExpectType BlockElementAction | ||
}) => { | ||
return action; | ||
}); | ||
|
||
// $ExpectType void | ||
app.action({ type: 'interactive_message' }, ({ | ||
action, // $ExpectType InteractiveAction | ||
}) => { | ||
return action; | ||
}); | ||
|
||
// $ExpectType void | ||
app.action({ type: 'dialog_submission' }, ({ | ||
action, // $ExpectType DialogSubmitAction | ||
}) => { | ||
return action; | ||
}); | ||
|
||
// If action is parameterized with MessageAction, action argument in callback should be type MessageAction | ||
// $ExpectType void | ||
app.action<MessageAction>({}, ({ | ||
action // $ExpectType MessageAction | ||
}) => { | ||
return action; | ||
}); | ||
|
||
/* Not working | ||
// Should error because MessageAction doesn't have an action_id | ||
// $ Expect Error | ||
app.actiong<MessageAction>({ action_id: 'dafasf' }, ({ action }) => { | ||
// NOT WORKING | ||
return action; | ||
}); | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// tslint:disable:no-useless-files | ||
// TypeScript Version: 3.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"lib": ["es5"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.