forked from parse-community/parse-server
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for multiple twitter auths options (parse-community#2256)
* Adds support for multiple twitter auths options * Adds user test
- Loading branch information
1 parent
80ac98c
commit 6abba9c
Showing
2 changed files
with
75 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
let twitter = require('../src/authDataManager/twitter'); | ||
|
||
describe('Twitter Auth', () => { | ||
it('should use the proper configuration', () => { | ||
// Multiple options, consumer_key found | ||
expect(twitter.handleMultipleConfigurations({ | ||
consumer_key: 'hello', | ||
}, [{ | ||
consumer_key: 'hello' | ||
}, { | ||
consumer_key: 'world' | ||
}]).consumer_key).toEqual('hello') | ||
|
||
// Multiple options, consumer_key not found | ||
expect(function(){ | ||
twitter.handleMultipleConfigurations({ | ||
consumer_key: 'some', | ||
}, [{ | ||
consumer_key: 'hello' | ||
}, { | ||
consumer_key: 'world' | ||
}]); | ||
}).toThrow(); | ||
|
||
// Multiple options, consumer_key not found | ||
expect(function(){ | ||
twitter.handleMultipleConfigurations({ | ||
auth_token: 'token', | ||
}, [{ | ||
consumer_key: 'hello' | ||
}, { | ||
consumer_key: 'world' | ||
}]); | ||
}).toThrow(); | ||
|
||
// Single configuration and consumer_key set | ||
expect(twitter.handleMultipleConfigurations({ | ||
consumer_key: 'hello', | ||
}, { | ||
consumer_key: 'hello' | ||
}).consumer_key).toEqual('hello'); | ||
|
||
// General case, only 1 config, no consumer_key set | ||
expect(twitter.handleMultipleConfigurations({ | ||
auth_token: 'token', | ||
}, { | ||
consumer_key: 'hello' | ||
}).consumer_key).toEqual('hello'); | ||
}); | ||
}); |
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