Giter Club home page Giter Club logo

advanced-testing-practice's Introduction

Testing Practice

Calculations

  • Implement the calculation functions

Function

  • Implement the code for the functions as described in the comments

Add Calculation Tests

  • subtracts 4 from 5 to equal 1
  • multiply 4 by 5 to equal 20
  • device 100 by 4 to equal 25

Add Function Tests

  • Implement the tests as described in the comments

User Button Tests

  • Create a folder for UserButtonContainer in containers
  • Move UserButtonsContainer.js into this folder and rename it index
  • Fix import paths
  • Add a file UserButtonsContainer.tests.js
    • Import UserButtonsContainer into the test
    • Import store into the test
    • create a variable called “wrapper”
    • in beforeAll, mount the Provider and UserButtonsContainer and assign to wrapper
    • Create a describe “Add User Button”
      • Create an it “should increase users array length by 1”
      • Use the wrapper to find the first button
      • Simulate a click on the button
      • use store.getState() to check the length of the users array
      • expect it toBe 1 more than the current length
    • Create a describe “Remove User Button”
      • Create an it “should decrease users array length by 1”
      • Use the wrapper to find the second button
      • Simulate a click on the button
      • use store.getState() to check the length of the users array
      • expect it toBe 1 less than the current length

User Display Tests

  • Create a folder for UserContainer in containers
  • Create a file for UserContainer.test.js
  • describe “UserContainer”
  • it “should render an li for each user”
  • mount Provider and SpecialTextContainer into wrapper
  • use the store to dispatch a “ADD_USER” action with the value of a user object
  • expect(wrapper.find(“li”)).to.have.length(8);

Hopefully at this point you can see there is a pattern to making the tests

ChangeTemperatureContainer.js

  • Create a test file for this container to ensure that when the text box changes, the state currentTemp changes

CityDropDownContainer.js

  • Create a test file to ensure that when the drop down changes, the state currentCity changes

CurrentCityContainer.js

  • Create a test file to ensure that when the state currentCity is change, the text of the div changes to “CurrentCity: whatever city”

advanced-testing-practice's People

Contributors

jw56578 avatar

Watchers

James Cloos avatar

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.