Giter Club home page Giter Club logo

testing's Introduction

Pairing Katas

Welcome to your first day of Pairing Katas, and your first sprint!

Check out setup.md to get started. If you're on GitHub, there's a link to it above here. If you're on VSCode, find it in the Explorer to the left.

The purpose of these exercises is to practice your TDD skills and to adjust to the idea of properly pair programming.

In your pairs, take turns being driver and navigator. Use git and the command line to handle sharing your repo, and switch to your machine when you switch drivers.

The goal of your tests is to ensure your functions return the correct output when given a range of inputs.

The most important thing to test is that your function behaves in the way it should! When you are confident that your function behaves as any reasonable user would expect it to, you should consider edge cases where the function may have to deal with extreme, unexpected, unusual or incorrect inputs - but focus on the 'happy path' first!

You are testing 'interfaces not implementations' - you care only about what your function returns when given some input. You should not try to test what exactly is happening inside the function or that people are using it in the correct way, just test that it returns the correct results for a range of different inputs.

Pairing katas tasks

  1. Follow the set-up instructions in setup.md.
  2. In your katas folder you will find a *.js file for each problem that needs solving. You can write your solution code here.
  3. Each kata will need a *.test.js file associated with it, in the __tests__ folder. You can write tests for your code here! You will need to import the function using const <functionName> = require('../path/to/function'). For example: const sumDigits = require('../katas/sum-digits.js')
  4. Run npm test to run every test in your __tests__ folder. Whenever you get one or two tests done, swap your pair roles!
  5. Below are two sets of katas for you to work on. Please do section 1 first - the order of the katas is a recommendation, but is not compulsory. However, do start with sumDigits as we have provided ideas for tests for this one.

Section 1

  • sumDigits (we've provided some ideas for tests for this one)
  • countVeg
  • alternateCase
  • getCentury
  • areOrdered
  • checkUsernames
  • maxAndMin
  • sumArgs
  • sumAscii
  • getYearsOfGrowth

Section 2

Note: think carefully about which Jest matcher is appropriate for each case!

  • orderVeg
  • checkStudents
  • range
  • removeDuplicates
  • getDistinctLetters
  • getMostRepeated
  • mergeArrays
  • getFrequencies
  • lengthenDate
  • caesarCipher

Resources

If you'd like a primer on Test Driven Development, read this blog post by Eric Elliott.

What is npm?

Using a package.json basics

What is in a package.json file

Jest documentation

testing's People

Contributors

lexielei98 avatar

Watchers

 avatar

Forkers

megbuna

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.