Skip to content

Commit

Permalink
rename wordblocklist
Browse files Browse the repository at this point in the history
  • Loading branch information
iranianpep committed Dec 29, 2020
1 parent 97c2d84 commit 5203938
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/__fixtures__/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const getTweetDefaultConfigs = (overrides?: Partial<TweetConfig>, userCon
minFavsToFollowers: 0.02,
hashtagsLimit: 5,
userConfig: getUserDefaultConfigs(userConfigOverrides),
wordBlockList: []
wordBlocklist: []
};

return {...defaultConfigs, ...overrides};
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/entities/tweet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ describe('Tweet', () => {
text: 'this tweet has a bad word in it'
}),
getTweetDefaultConfigs({
wordBlockList: ['bad', 'worst']
wordBlocklist: ['bad', 'worst']
})
);

Expand All @@ -174,7 +174,7 @@ describe('Tweet', () => {
text: ''
}),
getTweetDefaultConfigs({
wordBlockList: ['bad', 'worst']
wordBlocklist: ['bad', 'worst']
})
);

Expand All @@ -187,7 +187,7 @@ describe('Tweet', () => {
text: 'this is a good tweet'
}),
getTweetDefaultConfigs({
wordBlockList: ['bad', 'worst']
wordBlocklist: ['bad', 'worst']
})
);

Expand Down Expand Up @@ -347,7 +347,7 @@ describe('Tweet', () => {
statuses_count: 1000,
})
}), getTweetDefaultConfigs({
wordBlockList: ['worst']
wordBlocklist: ['worst']
}));

expect(tweet.isReTweetable()).toBe(false);
Expand Down
6 changes: 3 additions & 3 deletions src/entities/Tweet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type TweetConfig = {
minFavsToFollowers: number,
hashtagsLimit: number,
userConfig: TweetUserConfig,
wordBlockList?: string[]
wordBlocklist?: string[]
};

export default class Tweet extends ReTweetableAbstract {
Expand Down Expand Up @@ -56,14 +56,14 @@ export default class Tweet extends ReTweetableAbstract {
}

hasBlockListedWord(): boolean {
if (!Helper.objectExists(this.config.wordBlockList)
if (!Helper.objectExists(this.config.wordBlocklist)
|| !Helper.objectExists(this.rawTweet.text)) {
return false;
}

const tweetText = this.rawTweet.text.toLowerCase();

return this.config.wordBlockList.some(blockListedWord => tweetText.includes(blockListedWord.toLowerCase()));
return this.config.wordBlocklist.some(blockListedWord => tweetText.includes(blockListedWord.toLowerCase()));
}

getRetweetValidations(): Validation[] {
Expand Down

0 comments on commit 5203938

Please sign in to comment.