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

URO-209: add additional content and tests to orcidlink #215

Merged
merged 13 commits into from
Jun 20, 2024
Merged

Conversation

eapearson
Copy link
Contributor

@eapearson eapearson commented May 22, 2024

This set of changes implements URO-209, whose purpose is primarily adding additional content on views added in URO-208.

The changes include a few buttons, which do not invoke significant new functionality - just navigation and placeholder console logging (for testing.)

An addition was made to package.json, to pin testing-library/dom, which is required to avoid test warnings/error mesages when using @testing-library/user-event. This is due to conflicting dependencies, which end up specifying multiple versions of testing-library/dom transitively, which causes the error message `Warning: The current testing environment is not configured to support act(...)' to be emitted during tests (yes, a message labeled as "Warning", emitted via console.error, which does not cause test failure.)

One solution, taken here, is to use the advice in testing-library/user-event#1104 (comment), to pin @testing-library/dom to at least 9.0.1 (well, at least version 9).
I don't think updating storybook would help, but it may, as it is two major versions behind. Issues at storybook point the finger at testing-library/user-event.
I tested storybook, and it works fine with the pinned testing-library/dom.

@eapearson
Copy link
Contributor Author

have a couple more commits, but pre-commit is misbehaving, working on it ...

eapearson added 2 commits May 23, 2024 16:52
store in regularly named directory (per-feature), clean up url constants
@eapearson
Copy link
Contributor Author

@eapearson eapearson requested a review from dauglyon May 23, 2024 19:22
@dauglyon
Copy link
Collaborator

Apologies for the delay. Had an unproductive week last week. I have a review pending for this but I'm just poking at the dependency override, as that isn't ideal.

Copy link
Collaborator

@dauglyon dauglyon left a comment

Choose a reason for hiding this comment

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

The "act" issue is very frustrating and may be a motivator for moving to Vitest (though apparently, this can happen there, too).

Comment on lines 164 to 176
/**
* Make a copy of a given "json-compatible" value.
*
* This can be replaced with "structuredClone". In order to that that, we need
* to use core-js, but we don't have a direct dependency upon core-js; it is a
* transitive dependency of several packages already.
*
* This technique is not ideal, but in the limited usage of it for test data,
* works just fine.
*/
export function jsonCopy<T>(value: T): T {
return JSON.parse(JSON.stringify(value));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can make core-js a dev dependency as it would only run in the tests, that should mean it doesn't affect the build size/deps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @dauglyon , was this meant to be a request for change, or to record a comment for future improvement?

return JSON.parse(JSON.stringify(value));
}

/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe we have a noOp util func already

@eapearson
Copy link
Contributor Author

Hey @dauglyon, I'm still catching up after being out. I'm wondering whether you meant the comments above to be requests for change, or is this ready for merging.

@dauglyon
Copy link
Collaborator

You're good to merge, both were just minor suggestions

@eapearson
Copy link
Contributor Author

eapearson commented Jun 20, 2024

@dauglyon Great, thanks. I went ahead and implemented those changes anyway. noop was an oversight - i had searched case sensitively for noop so didn't see the noOp; as for copyJSON, thought that adding a line liner test function was better than a new dependency - and it gets confusing since structuredClone is considered by the dev environment to be available (since it is in node now and browsers for a couple years), but the ts config does not consider it available, and I didn't want to track that weirdness down ... anyway, adding the global import core-js/actual/structured-clone does the trick!

@eapearson eapearson merged commit 4913d05 into main Jun 20, 2024
4 checks passed
@eapearson eapearson deleted the URO-209 branch June 20, 2024 18:04
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