Skip to content
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

Merged
merged 27 commits into from
Aug 1, 2023

Conversation

RocketDerp
Copy link
Contributor

No description provided.

@RocketDerp

This comment was marked as abuse.

@RocketDerp

This comment was marked as abuse.

@RocketDerp

This comment was marked as abuse.

Copy link
Member

@dessalines dessalines left a 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"
Copy link
Member

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.

@@ -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?
Copy link
Member

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.

@@ -310,6 +319,34 @@ export async function getPost(
return api.client.getPost(form);
}

export async function getPosts(
Copy link
Member

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.

return api.client.getPosts(form);
}

export async function getPostsCID(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, unused.

@@ -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"?
Copy link
Member

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.

@RocketDerp

This comment was marked as abuse.

@dessalines
Copy link
Member

Alright then, if it passes we can merge. But be patient with PRs, we have a lot of things on our plate.

@RocketDerp

This comment was marked as abuse.

@RocketDerp

This comment was marked as abuse.

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
Copy link
Member

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.

@@ -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);
Copy link
Member

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);
Copy link
Member

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.

bio: "a revised bio. " + randomString(8),
show_read_posts: local_user.show_read_posts,
auth: api.auth,
};
Copy link
Member

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.

@Nutomic Nutomic enabled auto-merge (squash) August 1, 2023 12:36
@Nutomic
Copy link
Member

Nutomic commented Aug 1, 2023

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.

@Nutomic Nutomic merged commit 05a7fce into LemmyNet:main Aug 1, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants