Skip to content
This repository has been archived by the owner on Sep 29, 2021. It is now read-only.

Commit

Permalink
chore(flow): fix remaining flow errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jonfreedman committed Mar 25, 2017
1 parent f2b6c85 commit 7400ec6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
25 changes: 18 additions & 7 deletions src/adapter.js
Expand Up @@ -141,15 +141,26 @@ class SymphonyAdapter extends Adapter {

run () {
this.robot.logger.info('Initialising...');
const host: string = process.env.HUBOT_SYMPHONY_HOST;

const getEnv = function(key: string, defaultVal: ?string): string {
const value = process.env[key]
if (value) {
return value;
}
if (defaultVal) {
return defaultVal;
}
throw new Error(`${key} undefined`);
};
const host: string = getEnv('HUBOT_SYMPHONY_HOST');
this.symphony = new Symphony({
host: host,
privateKey: process.env.HUBOT_SYMPHONY_PRIVATE_KEY,
publicKey: process.env.HUBOT_SYMPHONY_PUBLIC_KEY,
passphrase: process.env.HUBOT_SYMPHONY_PASSPHRASE,
keyManagerHost: process.env.HUBOT_SYMPHONY_KM_HOST || host,
sessionAuthHost: process.env.HUBOT_SYMPHONY_SESSIONAUTH_HOST || host,
agentHost: process.env.HUBOT_SYMPHONY_AGENT_HOST || host
privateKey: getEnv('HUBOT_SYMPHONY_PRIVATE_KEY'),
publicKey: getEnv('HUBOT_SYMPHONY_PUBLIC_KEY'),
passphrase: getEnv('HUBOT_SYMPHONY_PASSPHRASE'),
keyManagerHost: getEnv('HUBOT_SYMPHONY_KM_HOST', host),
sessionAuthHost: getEnv('HUBOT_SYMPHONY_SESSIONAUTH_HOST', host),
agentHost: getEnv('HUBOT_SYMPHONY_AGENT_HOST', host)
});
this.symphony.whoAmI()
.then((response) => {
Expand Down
10 changes: 0 additions & 10 deletions test/symphony-test.js
Expand Up @@ -143,16 +143,6 @@ describe('REST API test suite', () => {
});
});

it('getUser should fail if called with just a string arg', (done) => {
symphony.getUser(nock.realUserId)
.then((response) => {
done('Expecting failure');
})
.catch((error) => {
done();
});
});

it('sendMessage should obtain session and key tokens and get message ack', (done) => {
let msg = '<messageML>Testing 123...</messageML>';
symphony.sendMessage(nock.streamId, msg, 'MESSAGEML')
Expand Down

0 comments on commit 7400ec6

Please sign in to comment.