-
-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced testing of comments. Validate reply notifications, mentions #3686
Enhanced testing of comments. Validate reply notifications, mentions #3686
Conversation
…code comment cleanup in other functions
This comment was marked as abuse.
This comment was marked as abuse.
…h other jest runs
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this done or still a WIP? You added some functions that are unused.
@@ -9,7 +9,7 @@ | |||
"scripts": { | |||
"lint": "tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src && prettier --check 'src/**/*.ts'", | |||
"fix": "prettier --write src && eslint --fix src", | |||
"api-test": "jest -i follow.spec.ts && jest -i src/post.spec.ts && jest -i comment.spec.ts && jest -i private_message.spec.ts && jest -i user.spec.ts && jest -i community.spec.ts" | |||
"api-test": "jest -i follow.spec.ts && jest -i post.spec.ts && jest -i comment.spec.ts && jest -i private_message.spec.ts && jest -i user.spec.ts && jest -i community.spec.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm... wonder why it ran the test correctly before. Oh well.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -299,12 +304,30 @@ test("Reply to a comment", async () => { | |||
expect(alphaComment.creator.local).toBe(false); | |||
expect(alphaComment.counts.score).toBe(1); | |||
assertCommentFederation(alphaComment, replyRes.comment_view); | |||
|
|||
// Did alpha get notified of the reply from beta? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for adding these checks.
api_tests/src/shared.ts
Outdated
@@ -310,6 +319,34 @@ export async function getPost( | |||
return api.client.getPost(form); | |||
} | |||
|
|||
export async function getPosts( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is unused.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
api_tests/src/shared.ts
Outdated
return api.client.getPosts(form); | ||
} | ||
|
||
export async function getPostsCID( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, unused.
api_tests/src/shared.ts
Outdated
@@ -623,6 +678,30 @@ export async function saveUserSettingsBio(api: API): Promise<LoginResponse> { | |||
return saveUserSettings(api, form); | |||
} | |||
|
|||
// Feedback request: is this an ideal way to do it? Send back the whole form, even if changing just a couple values? | |||
// In other words, is there some built-in client way to cline a read of Localuser into a write of SaveUserSettings object? | |||
// ToDo: it seems if you revise nothing on a profile, this throws "user_already_exists"? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its not necessary to send the current entire local user, only the ones that have changed. 2ndly, this function is also unused.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Alright then, if it passes we can merge. But be patient with PRs, we have a lot of things on our plate. |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
api_tests/run-federation-test.sh
Outdated
cp target/debug/lemmy_server target/lemmy_server | ||
./api_tests/prepare-drone-federation-test.sh | ||
popd | ||
|
||
yarn | ||
yarn api-test || true | ||
|
||
killall -s1 lemmy_server | ||
# DROP DATABASE will fail if there are active users of database | ||
if pgrep lemmy_server; then echo "killing running lemmy_server"; killall -s1 lemmy_server; fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theres no reason to run this twice.
api_tests/src/comment.spec.ts
Outdated
@@ -42,6 +44,7 @@ beforeAll(async () => { | |||
await followBeta(gamma); | |||
let betaCommunity = (await resolveBetaCommunity(alpha)).community; | |||
if (betaCommunity) { | |||
// Note: throughout this code, postRes shall be an alpha copy of the post | |||
postRes = await createPost(alpha, betaCommunity.community.id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to rename the var instead of putting a comment which can easily get outdated.
// TODO not sure why, but a searchComment back to alpha, for the ap_id of betas | ||
// comment, isn't working. | ||
// let searchAlpha = await searchComment(alpha, replyRes.comment); | ||
let postComments = await getComments(alpha, postRes.post_view.post.id); | ||
// Note: in Lemmy 0.18.3 pre-release this is coming up 7 | ||
expect(postComments.comments.length).toBeGreaterThanOrEqual(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe other tests arent doing proper cleanup. Try running only this one.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
api_tests/src/shared.ts
Outdated
bio: "a revised bio. " + randomString(8), | ||
show_read_posts: local_user.show_read_posts, | ||
auth: api.auth, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only need to set the values which are actually changed. Everything thats unchanged can remain unset/null.
…nt which can easily get outdated.
…ps. Allows Open and Applications. (LemmyNet#3761) Co-authored-by: Josh Bernardini <josh.bernardini@cologix.com>
I had to edit your PR manually again to remove unused code and remove the unnecessary killall change, which I both mentioned in the review. It would be nice if you could address reviews yourself in the future, so that I have time to work on more important things. Otherwise you are creating more work for me than you are helping. |
No description provided.