Skip to content

Added testingWithJest, a workshop on Unit Testing with Jest #261

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 1 commit into
base: main
Choose a base branch
from

Conversation

beaumoaj
Copy link

@beaumoaj beaumoaj commented Nov 8, 2024

I have added a workshop on Unit Testing with Jest.
I spoke to Caroline Scherf about this and gave her a quick walkthrough of the workshop. She asked me to create this pull request.

The docs folder contains the instructions in the index.html.

The Javascript files in the project are:

  1. day.js - implements some functionality to maintain a list of appointments in a day. The focus of the workshop is the function called makeAppointment down towards the bottom of the file.
  2. dayDemo.js - a demo program to show how to use day.js
  3. day.test.js - contains three tests that test functionality in day.js. The first one tests that setUpDay correctly sets up a day with all appointment slots available, the second tests that we can make an appointment at 9 am on an empty day, the third tests that we should not be able to make an appointment before the start of the day (at 8 am). The first two tests pass and the third one fails.

The index.html is generated from the README.md using claat (from https://github.com/googlecodelabs/tools/releases). I use the following script to format the markdown into HTML:

#! /bin/sh 

if [ $# -eq 1 ]
then
    STYLE="<\/style><link rel='stylesheet' href='cyf.css'\/>"
    claat export $1

    sed -i "s/<\/style>/$STYLE/g" ./*/index.html
else
    echo "Please enter a markdown file to process"
fi

Copy link

netlify bot commented Nov 8, 2024

👷 Deploy request for cyf-workshops pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 70b81f2

Copy link

netlify bot commented Nov 8, 2024

Deploy Preview for cyf-workshop ready!

Name Link
🔨 Latest commit 70b81f2
🔍 Latest deploy log https://app.netlify.com/sites/cyf-workshop/deploys/672df06a9713af0008088e57
😎 Deploy Preview https://deploy-preview-261--cyf-workshop.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@SallyMcGrath
Copy link
Member

Thanks so much for this, @beaumoaj ! Just spotted it as I was over here.

Is it possible for you to add some learning objectives to the top? Just 2 would do.
https://common.codeyourfuture.io/common-theme/shortcodes/objectives/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

2 participants