Skip to content

[ENG-10364] Part 1: Add unit tests for preprints#895

Merged
brianjgeiger merged 5 commits intoCenterForOpenScience:feature/pbs-26-2from
nsemets:test/preprint-pages
Mar 4, 2026
Merged

[ENG-10364] Part 1: Add unit tests for preprints#895
brianjgeiger merged 5 commits intoCenterForOpenScience:feature/pbs-26-2from
nsemets:test/preprint-pages

Conversation

@nsemets
Copy link
Collaborator

@nsemets nsemets commented Feb 25, 2026

  • Ticket: [ENG-10364]
  • Feature flag: n/a

Summary of Changes

  1. Update unit tests for preprints pages.

@nsemets nsemets requested a review from brianjgeiger February 25, 2026 14:21
Copy link
Contributor

@brianjgeiger brianjgeiger left a comment

Choose a reason for hiding this comment

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

A couple of questions, and one test that looks like it might not be testing everything it says it is.

it('should compute latest withdrawal request correctly', () => {
const latestRequest = component.latestWithdrawalRequest();
expect(latestRequest).toBe(mockWithdrawalRequests[0]);
it('should show toast error for 409 on create new version', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the ideal workflow here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean? I can simplify it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean more from a user perspective, should we ever actually 409, or should the front-end prevent that from happening?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just added tests to cover the existing code. I’m not sure when or under what conditions this should happen for the user. I assume there was a specific case for it, so it was added.

it('should compute is pending withdrawal', () => {
const pending = component.isPendingWithdrawal();
expect(typeof pending).toBe('boolean');
it('should show edit button for latest or initial preprint', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this actually also testing for latest version, or just initial version?

Copy link
Collaborator Author

@nsemets nsemets Mar 4, 2026

Choose a reason for hiding this comment

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

It tests initial version. I will change name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add another test to ensure that it shows edit button for latest preprints? I think I saw a bug report about that coming to us soon.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I can add.

Copy link
Contributor

@brianjgeiger brianjgeiger left a comment

Choose a reason for hiding this comment

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

A couple of questions, and one test that looks like it might not be testing everything it says it is.

@nsemets nsemets requested a review from brianjgeiger March 4, 2026 12:29
Copy link
Contributor

@brianjgeiger brianjgeiger left a comment

Choose a reason for hiding this comment

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

Add one test and I think we're good.

Copy link
Contributor

@brianjgeiger brianjgeiger left a comment

Choose a reason for hiding this comment

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

This is good once tests run.

@brianjgeiger brianjgeiger merged commit 2ae4c46 into CenterForOpenScience:feature/pbs-26-2 Mar 4, 2026
3 checks 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.

2 participants