Skip to content

Conversation

cjyuan
Copy link
Contributor

@cjyuan cjyuan commented Oct 1, 2025

Changelist

Summary

This PR updates the ToDo List exercise with the following improvements:

  • Introduces the use of ESM with Node.js and Jest.
  • Emphasizes separating code into UI and non-UI modules, enabling non-UI parts to be tested independently with Jest.

Changes in Exercise

Before:

  • Trainees implemented a ToDo List app.
  • Mass delete of completed ToDos was positioned as an advanced challenge.

Now:

  • Trainees are given a ToDo List app already implemented in ESM, with code separated into UI and non-UI modules.
  • Trainees need to:
    • Modify the code to implement mass delete of completed ToDos.
    • Add a Jest test to validate the mass delete function.

Related Issues in Curriculum

CodeYourFuture/curriculum#414
CodeYourFuture/curriculum#1289
CodeYourFuture/curriculum#1296
CodeYourFuture/curriculum#1448

Checklist

Who needs to know about this?

@illicitonion

Copy link

github-actions bot commented Oct 1, 2025

Your PR's title isn't in the expected format.

Please check the expected title format, and update yours to match.

Reason: Wrong number of parts separated by |s

Copy link

github-actions bot commented Oct 2, 2025

Your PR's title isn't in the expected format.

Please check the expected title format, and update yours to match.

Reason: Wrong number of parts separated by |s

Copy link
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

This looks great, thanks! I made a few suggestions here, and also a few in https://github.com/cjyuan/Module-Data-Groups/pull/1/files from when I was doing the exercise itself.

Comment on lines +45 to +50
## `jsdom`

[**`jsdom`**](https://github.com/jsdom/jsdom), a pure-JavaScript implementation of DOM for
use with Node.js, **does not yet support** `<script type="module">` tags in HTML.

Testing an ESM-based application with `jsdom` requires additional configuration and third-party tooling. No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

Have we introduced JSDOM anywhere before in the course? If not, we probably want a whole "intro to JSDOM" before we write this, maybe in its own md file?

But I don't think we're even using it in this project, so we probably want to just remove this and introduce it if/when we introduce JSDOM?

Copy link
Contributor Author

@cjyuan cjyuan Oct 2, 2025

Choose a reason for hiding this comment

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

All the Web app exercises in Sprint-3 folder (including the old Todo List app) include a Jest test script that uses JSDOM. I think that's when most trainees first encountered JSDOM. A few of them tried to understand how it works or tried to implement their apps to pass the tests, but most simply ignore the test script. (When I reviewed their code, I didn't use the test script to check their implementation).

Should we update one of the web app exercises to introduce testing with JSDOM? Last I checked it does not yet work with ESM unless we use some tool chain.

Copy link
Member

Choose a reason for hiding this comment

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

Oh wow, yeah, it looks like we wrote tests in a very "run these but don't edit or understand them" style, and we don't event mention them in the README. Let's maybe attach an order to the exercises (maybe starting with the quote generator?) and add an intro to the JSDOM tests in there?

Let's keep what you have here, and separately add a bit of JSDOM introduction! Thanks!

@illicitonion
Copy link
Member

Also FYI I made CodeYourFuture/trainee-tracker#21 to stop validating NotCoursework PRs :)

@cjyuan
Copy link
Contributor Author

cjyuan commented Oct 3, 2025

This looks great, thanks! I made a few suggestions here, and also a few in https://github.com/cjyuan/Module-Data-Groups/pull/1/files from when I was doing the exercise itself.

  • I incorporated all your suggested changes, including those mentioned in the other PR.
  • What would you like to do with the note about JSDOM?

Copy link
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

LGTM! Just that one suggestion about <span> tags and I think we're good to merge!

I just edited #8 to mark it mandatory, I'll also rename the issues that sprint to make them be ordered usefully.

Co-authored-by: Daniel Wagner-Hall <[email protected]>
@cjyuan cjyuan merged commit aa7da66 into CodeYourFuture:main Oct 3, 2025
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