TogetherCrew / twitter-analytics

This repository is in responsible of twitter analytics tasks of TogetherCrew.
1 stars 0 forks source link

Queries for tests of twitter dashboard - "Your account activity" section #6

Open amindadgar opened 1 year ago

amindadgar commented 1 year ago

In this issue, we're going to write the queries to insert data related to the tests that would be implemented in backend. Basically, we have to write tests for the conditions below Your account activity

amindadgar commented 1 year ago

The test related to the Number of posts, the user made

We first need to insert data using the query below

MERGE (a:TwitterAccount {userId: "1111"})
MERGE (a2:TwitterAccount {userId: "1112"})
MERGE (t:Tweet {tweetId: "123", authorId: "1111"})
MERGE (t2:Tweet {tweetId: '124', authorId: "1111"})
MERGE (t3:Tweet {tweetId: '125', authorId: "1112"})
MERGE (t4:Tweet {tweetId: '126', authorId: "1111"})

MERGE (a)-[:TWEETED {createdAt: '{Epoch2dayAgo}']->(t)
MERGE (a)-[:TWEETED {createdAt: '{Epoch8dayAgo}']->(t2)
MERGE (a2)-[:TWEETED {createdAt: '{Epoch5dayAgo}']->(t3)
MERGE (a)-[:TWEETED {createdAt: '{Epoch3dayAgo}']->(t4)

The results for userId equal to 1111 should be 2 and for userId equal to 1112 shuold be 1.

Note: the Epochs in queries are self explained as the variable name.

amindadgar commented 1 year ago

The tests related to the Number of replies the user made

We first need to insert data using the queries below

MERGE (a:TwitterAccount {userId: "1111"})
MERGE (a2:TwitterAccount {userId: "1112"})
MERGE (t:Tweet {tweetId: "123", authorId: "1111"})
MERGE (t2:Tweet {tweetId: '124', authorId: "1111"})
MERGE (t3:Tweet {tweetId: '125', authorId: "1112"})
MERGE (t4:Tweet {tweetId: '126', authorId: "1111"})
MERGE (t5:Tweet {tweetId: '127', authorId: "1112"})

MERGE (a)-[:TWEETED {createdAt: '{Epoch2dayAgo}']->(t)
MERGE (a)-[:TWEETED {createdAt: '{Epoch1dayAgo}']->(t4)

MERGE (t2)-[:REPLIED {createdAt: '{Epoch1dayAgo}']->(t)
MERGE (t3)-[:REPLIED {createdAt: '{Epoch2dayAgo}']->(t)
MERGE (t5)-[:REPLIED {createdAt: '{Epoch4dayAgo}']->(t4)

The results for userId equal to 1111 should be equal to 0 and the results for userId equal to 1112 should be 2.

Note: The Epochs are timestamps in queries which are self explained as the variable name.

amindadgar commented 1 year ago

The tests related to Number of retweets the user made

We first need to insert data using the queries below

MERGE (a:TwitterAccount {userId: "1111"})
MERGE (a2:TwitterAccount {userId: "1112"})
MERGE (t:Tweet {tweetId: "123", authorId: "1111"})
MERGE (t2:Tweet {tweetId: '124', authorId: "1111"})
MERGE (t3:Tweet {tweetId: '125', authorId: "1112"})
MERGE (t4:Tweet {tweetId: '126', authorId: "1111"})
MERGE (t5:Tweet {tweetId: '127', authorId: "1112"})

MERGE (a)-[:TWEETED {createdAt: '{Epoch2dayAgo}']->(t)
MERGE (a)-[:TWEETED {createdAt: '{Epoch1dayAgo}']->(t4)

MERGE (t2)-[:RETWEETED {createdAt: '{Epoch1dayAgo}']->(t)
MERGE (t3)-[:REPLIED {createdAt: '{Epoch2dayAgo}']->(t)
MERGE (t5)-[:RETWEETED {createdAt: '{Epoch4dayAgo}']->(t4)

The results for userId equal to 1111 should be equal to 0 and the results for userId equal to 1112 should be 1.

Note: The Epochs are timestamps in queries which are self explained as the variable name.

amindadgar commented 1 year ago

The test for Number of likes the user made

First insert the data into the database using the queries below

MERGE (a:TwitterAccount {userId: "1111"})
MERGE (a2:TwitterAccount {userId: "1112"})
MERGE (t:Tweet {tweetId: "123", authorId: "1111", createdAt: "{Epoch5dayAgo}"})
MERGE (t2:Tweet {tweetId: '124', authorId: "1111", createdAt: "{Epoch4dayAgo}"})
MERGE (t3:Tweet {tweetId: '125', authorId: "1112", createdAt: "{Epoch7dayAgo}"})
MERGE (t4:Tweet {tweetId: '126', authorId: "1111", createdAt: "{Epoch3dayAgo}"})
MERGE (t5:Tweet {tweetId: '127', authorId: "1112", createdAt: "{Epoch8dayAgo}"})

MERGE (a)-[:TWEETED {createdAt: '{Epoch2dayAgo}']->(t)
MERGE (a)-[:TWEETED {createdAt: '{Epoch3dayAgo}']->(t2)
MERGE (a)-[:TWEETED {createdAt: '{Epoch5dayAgo}']->(t4)
MERGE (a2)-[:TWEETED {createdAt: '{Epoch4dayAgo}']->(t3)
MERGE (a2)-[:TWEETED {createdAt: '{Epoch3dayAgo}']->(t5)

MERGE (a)-[:LIKED {latestSavedAt: '{Epoch1dayAgo}']->(t)
MERGE (a)-[:LIKED {latestSavedAt: '{Epoch1dayAgo}']->(t2)
MERGE (a)-[:LIKED {latestSavedAt: '{Epoch1dayAgo}']->(t3)
MERGE (a)-[:LIKED {latestSavedAt: '{Epoch1dayAgo}']->(t5)

MERGE (a2)-[:LIKED {latestSavedAt: '{Epoch1dayAgo}']->(t)
MERGE (a2)-[:LIKED {latestSavedAt: '{Epoch1dayAgo}']->(t3)
MERGE (a2)-[:LIKED {latestSavedAt: '{Epoch1dayAgo}']->(t5)

The results for userId equal to 1111 should be equal to 2 and the results for userId equal to 1112 should be 1.

Note: The Epochs are timestamps in queries which are self explained as the variable name.

amindadgar commented 1 year ago

The test for Number of mentions the user made

First we need to insert the data using the queries below

MERGE (a:TwitterAccount {userId: "1111"})
MERGE (a2:TwitterAccount {userId: "1112"})
MERGE (t:Tweet {tweetId: "123", authorId: "1111", createdAt: "{Epoch5dayAgo}"})
MERGE (t2:Tweet {tweetId: '124', authorId: "1111", createdAt: "{Epoch4dayAgo}"})
MERGE (t3:Tweet {tweetId: '125', authorId: "1112", createdAt: "{Epoch7dayAgo}"})
MERGE (t4:Tweet {tweetId: '126', authorId: "1111", createdAt: "{Epoch3dayAgo}"})
MERGE (t5:Tweet {tweetId: '127', authorId: "1112", createdAt: "{Epoch8dayAgo}"})

MERGE (a)-[:TWEETED {createdAt: '{Epoch2dayAgo}']->(t)
MERGE (a)-[:TWEETED {createdAt: '{Epoch3dayAgo}']->(t2)
MERGE (a)-[:TWEETED {createdAt: '{Epoch4dayAgo}']->(t4)
MERGE (a2)-[:TWEETED {createdAt: '{Epoch4dayAgo}']->(t3)
MERGE (a2)-[:TWEETED {createdAt: '{Epoch3dayAgo}']->(t5)

MERGE (t) -[:MENTIONED {createdAt: '{Epoch2dayAgo}'] -> (a)
MERGE (t) -[:MENTIONED {createdAt: '{Epoch2dayAgo}'] -> (a2)
MERGE (t2) -[:MENTIONED {createdAt: '{Epoch3dayAgo}'] -> (a2)
MERGE (t3) -[:MENTIONED {createdAt: '{Epoch4dayAgo}'] -> (a2)

The results for userId equal to 1111 should be equal to 2 and the results for userId equal to 1112 should be 0.

Note: The Epochs are timestamps in queries which are self explained as the variable name.