Skip to content

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

Open
nsemets wants to merge 3 commits intoCenterForOpenScience:feature/pbs-26-2from
nsemets:test/preprint-pages
Open

[ENG-10364] Part 1: Add unit tests for preprints#895
nsemets wants to merge 3 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.

<osf-review-step [provider]="preprintProvider()" />
@let provider = preprintProvider();

@if (provider) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a case where a preprint wouldn't have a provide, I wonder? And if so, does this mean that they wouldn't be able to add a version?

I think all preprints should have a provider, so probably this is useful from a code safety measure, but shouldn't be bypassed in actual use.

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?

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
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.

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