TwitterStreamChannelsMock
Summary
This class mocks TwitterStreamChannels so that you could work offline, on your own data, without connecting to Twitter.
See the examples on the github repo
Constructor
TwitterStreamChannelsMock
Syntax
Summary
Parameters:
-
[options]
Object optional@optional (since it's a mock, no credentials needed
-
[tweets]
File optional@optional (by default will load
/mocks/data/tweets.json
) -
[singleRun=true]
Boolean optional@optional if false will loop on the tweets mock array until you call stop (default true)
-
[tweetDelay=100]
Number optional@optional delay between each tweets emitted in ms (default 100ms)
-
Returns:
Item Index
Methods
Methods
getApiClient
Syntax
getApiClient
()
TwitMock
Summary
Returns a mocked version of apiClient, only the .stream() method is mocked (will stream exactly the same tweets as stream.streamChannels())
Returns:
streamChannels
Syntax
Summary
Mocks the TwitterStreamChannels.streamChannels(options) method of TwitterStreamChannels to return a StreamChannels object
Will start to emit the tweets you specified in the tweets attributes in the constructor.
Parameters:
-
options
Object-
track
Object | ArrayPass an object describing your channels. If you don't want to use channels, you can pass directly an array of keywords.
-
[enableChannelsEvents=true]
Boolean optionalIf true, will fire the events like 'channels/channelName'
-
[enableRootChannelsEvent=true]
Boolean optionalIf true, will fire the event 'channels'
-
[enableKeywordsEvents=false]
Boolean optionalIf true, will fire the events 'keywords/keywordName' (disabled by default)
-