Skip to content

Commit

Permalink
allow tests to run without local configure file
Browse files Browse the repository at this point in the history
  • Loading branch information
radiovisual committed Dec 28, 2015
1 parent 932d058 commit c161010
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import credentials from './../birdwatch-config.js';
import testData from './../test/testTweets.json';
import tweetPatch from 'tweet-patch';
import underscore from 'underscore';
Expand Down Expand Up @@ -58,6 +57,8 @@ export async function getTwitterData(screenname, options) {
resolve(testData);
}

const credentials = require('./../birdwatch-config.js');

const oauth = new OAuth.OAuth(
'https://api.twitter.com/oauth/request_token',
'https://api.twitter.com/oauth/access_token',
Expand Down
6 changes: 3 additions & 3 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ test('should fail if no feed is supplied', async t => {
});

test('should get tweet data returned from Birdwatch.getCachedTweets()', async t => {
const bw = await new Birdwatch().feed('birdwatchnpm', {}).start();
const bw = await new Birdwatch({useTestData:true}).feed('test', {}).start();
t.is(typeof bw.getCachedTweets()[0].text, 'string');
});

test('should fail when filterTags is not a valid regex', async t => {
const bw = await new Birdwatch().feed('birdwatchnpm', {filterTags: 'a'});
t.throws(bw.start(), 'Invalid regex: a for birdwatchnpm');
const bw = await new Birdwatch({useTestData:true}).feed('test', {filterTags: 'a'});
t.throws(bw.start(), 'Invalid regex: a for test');
});

test('should filter hashtags', async t => {
Expand Down

0 comments on commit c161010

Please sign in to comment.