Skip to content

Commit

Permalink
fix(twitter-user): remove name attribute from TwitterUser model, serv…
Browse files Browse the repository at this point in the history
…ices, routes and tests (#45)

* fix(twitter-user): remove name attribute from TwitterUser object

* Remove name attribute from a couple of tests

Co-authored-by: David Cabeza <[email protected]>
  • Loading branch information
german1608 and davideluque authored Jun 16, 2020
1 parent 54454ff commit 1312432
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/calculator/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export interface TweetCredibilityWeights extends TextCredibilityWeights {
}

export interface TwitterUser {
name: string
verified: boolean
yearJoined: number
followersCount: number
Expand Down
1 change: 0 additions & 1 deletion src/calculator/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ calculatorRoutes.get('/tweets/scraped', validate('scrapedTweetCredibility'), asy
weightSocial: +req.query.weightSocial,
},
{
name: '',
verified: req.query.verified === 'true',
yearJoined: +req.query.yearJoined,
followersCount: +req.query.followersCount,
Expand Down
3 changes: 0 additions & 3 deletions src/calculator/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const spellingCheckers = {

function responseToTwitterUser(response: any) : TwitterUser {
return {
name: response.name,
verified: response.verified,
yearJoined: response.created_at.split(' ').pop(),
followersCount: response.followers_count,
Expand Down Expand Up @@ -188,7 +187,6 @@ async function twitterUserCredibility(userId: string) {

function scrapperTwitterUserCredibility(verified: boolean, accountCreationYear: number) : Credibility{
const user: TwitterUser = {
name: '',
verified: verified,
yearJoined: accountCreationYear,
followersCount: 0,
Expand Down Expand Up @@ -266,7 +264,6 @@ async function scrapedtweetCredibility(tweetText: Text, tweetCredibilityWeights:

function scrapedSocialCredibility(followersCount: number, friendsCount: number, maxFollowers: number){
const user : TwitterUser = {
name: '',
verified: false,
yearJoined: 2018,
followersCount: followersCount,
Expand Down
1 change: 0 additions & 1 deletion tests/calculus-endpoints/social-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ describe('/calculate/twitter/social/:userId endpoint', () => {
Twit.prototype.get = jest.fn((path: string, params?: any) =>new Promise((resolve:any, reject:any) => resolve({
data: {
id: 91891658,
name: 'Test name',
followers_count: 116,
friends_count: 138,
created_at: 'Mon Feb 21 01:59:02 +0000 2011',
Expand Down
4 changes: 0 additions & 4 deletions tests/calculus-endpoints/social-scrapped.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ describe('/calculate/social/scrape endpoint', () => {

describe('1.200.000 followers, 421 following', () => {
const params = {
name: '',
verified: false,
yearJoined: 2000,
followersCount: 1200000,
Expand All @@ -30,7 +29,6 @@ describe('/calculate/social/scrape endpoint', () => {

describe('5.000.000 followers, 421 following, 2.000.000 MaxFollowers', () => {
const params = {
name: '',
verified: false,
yearJoined: 2000,
followersCount: 5000000,
Expand All @@ -46,7 +44,6 @@ describe('/calculate/social/scrape endpoint', () => {
// the 0,0 pair should return.
// describe('zero followers, zero following', () => {
// const params = {
// name: '',
// verified: false,
// yearJoined: 2000
// }
Expand All @@ -72,7 +69,6 @@ describe('/calculate/social/scrape endpoint', () => {

describe('negative followers, positive followings', () => {
const params = {
name: '',
verified: false,
yearJoined: 2000,
followersCount: -1,
Expand Down
1 change: 0 additions & 1 deletion tests/calculus-endpoints/tweet-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ describe('/twitter/tweets', () => {
lang: 'en',
user: {
id: 91891658,
name: 'Test name',
followers_count: 0,
friends_count: 0,
created_at: 'Mon Feb 21 01:59:02 +0000 2011',
Expand Down
3 changes: 0 additions & 3 deletions tests/calculus-endpoints/tweet-scrapped.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ describe('/calculate/tweets/scraped endpoint', () => {
weightSocial: 0,
}
const twitterUser : TwitterUser = {
name: '',
verified: false,
yearJoined: 2010,
followersCount: 2000,
Expand Down Expand Up @@ -62,7 +61,6 @@ describe('/calculate/tweets/scraped endpoint', () => {
weightSocial: 0
}
const twitterUser : TwitterUser = {
name: '',
verified: true,
yearJoined: 2006,
friendsCount: 2000,
Expand Down Expand Up @@ -120,7 +118,6 @@ describe('/calculate/tweets/scraped endpoint', () => {
weightSocial: 1
}
const twitterUser : TwitterUser = {
name: '',
verified: true,
yearJoined: 2006,
friendsCount: 2000,
Expand Down
1 change: 0 additions & 1 deletion tests/calculus-endpoints/user-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ describe('/twitter/user/:id endpoint', () => {
Twit.prototype.get = jest.fn((path: string, params?: any) =>new Promise((resolve:any, reject:any) => resolve({
data: {
id: 91891658,
name: 'Test name',
followers_count: 116,
friends_count: 138,
created_at: 'Mon Feb 21 01:59:02 +0000 2011',
Expand Down
1 change: 0 additions & 1 deletion tests/calculus-endpoints/user-scrapped.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ describe('/user/scrape endpoint', () => {
}
describe('verified true, year joined 2006', () => {
const params = {
name: 'f',
followersCount: 123,
friendsCount: 12
}
Expand Down

0 comments on commit 1312432

Please sign in to comment.