4IT580: Docs
4IT580 WebGithub

9th Practical Class:
Unit Testing

Unit Testing: Jest

frontend/src/utils/sum.js:



















Simple Unit Test

frontend/src/utils/__tests__/sum.js:







React Testing Library

frontend/src/modules/auth/organisms/__tests__/SignInForm.js:

Game Of Life

For more information visit the Conway's Game of Life page at Wikipedia.

Rule # 1

Any live cell with fewer than two live neighbors dies, as if by underpopulation.

☠️☠️☠️
☠️🦠☠️
☠️☠️🦠

generation x + 1

☠️

Rule # 2

Any live cell with two or three live neighbors lives on to the next generation.

generation x (n = 2,3)

☠️☠️☠️
🦠🦠☠️
☠️🦠🦠

generation x + 1

🦠

Rule # 3

Any live cell with more than three live neighbors dies, as if by overpopulation.

generation x (n > 3)

🦠🦠🦠
🦠🦠🦠
🦠🦠🦠

generation x + 1

☠️

Rule # 4

Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.

generation x (n = 3)

☠️☠️☠️
🦠☠️☠️
☠️🦠🦠

generation x + 1

🦠

All Rules:








Test Drivend Deveopment (TDD)


  1. Write Failing Test
  2. Fix Tests
  3. Refactor
    repeat!






TDD Cycle


1. Write Failing Test


2. Fix Failing Test
(as fast as possible)


3. Refactor


5. Write Failing Test
(repeat!)