Skip to content

CYF Glasgow | Iakub Dubachev | Module-Data-Groups | Quote Generator | WEEK 3 #245

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

IakubDubachev
Copy link

@IakubDubachev IakubDubachev commented Dec 24, 2024

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist
This PR improves the reliability and clarity of the quote generator tests. Key updates include:

Async userEvent.click Integration: Ensured userEvent.click is properly awaited to avoid race conditions.

Element Existence Checks: Added explicit checks to confirm the presence of the #new-quote button before interaction.

Improved Cleanup: Used jest.clearAllMocks alongside jest.restoreAllMocks in the afterEach hook to prevent cross-test contamination.

Error Handling in beforeEach: Added error handling during JSDOM.fromFile initialization to log potential setup failures.

Assertion Consistency: Ensured predictable quote and author assertions based on mocked Math.random values.

Questions

Are there any additional edge cases you’d suggest covering in these tests?

Does the error handling during JSDOM initialization align with our project's testing standards?

Would you recommend further improvements to the structure or clarity of these tests?

@IakubDubachev IakubDubachev added the Needs Review Participant to add when requesting review label Dec 25, 2024
@halilibrahimcelik halilibrahimcelik self-requested a review December 27, 2024 14:25
@halilibrahimcelik halilibrahimcelik added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Participant to add when requesting review labels Dec 27, 2024
@halilibrahimcelik
Copy link

I'm getting this error. Keep in mind that while defining constants and static data, you should always define them at the top level.
JavaScript reads and executes scripts from top to bottom. If you declare and initialize a variable or constant at the bottom of your script but reference it earlier, the browser encounters the reference before the variable is initialized, leading to this error.
image

@halilibrahimcelik
Copy link

Also make sure you passed all tests before creating a PR.
image

@halilibrahimcelik
Copy link

Lastly, although it is not the primary focus of this project, enhancing the display of quotes with some styling would be a valuable addition. This improvement would not only make the presentation more visually appealing but also provide an opportunity to gain more experience with CSS and user interface design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants