Skip to content

Instantly share code, notes, and snippets.

@jose8a
Created June 18, 2015 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jose8a/7143b4c72e24a13c34a8 to your computer and use it in GitHub Desktop.
Save jose8a/7143b4c72e24a13c34a8 to your computer and use it in GitHub Desktop.
Notes on Udacity's JS TDD course

Jasmine library ..

SpecRunner.html --> top-level file for setting up and running tests on Jasmine Specs (XXXSpec.js, YYYSpec.js, etc) --> individual spec files container individual tests, as well as Suites of tests

describe --> identifies a "suite" -- that is, a group of related "specs" it --> identifies a spec in a "Test Suite" ... typically colored green

"Typical" test architecture:

expect( add(1, 2) ).toBe( 3 );

  • 'expect' is the test identifier ... starts the test process
  • 'add(1, 2)' is called the "action/actual?" ... the method we want to test
  • 'toBe' is called the "matcher". It is the comparison function we want to use.
  • '3' is the "expected value" that we want the matcher to compare against the result from the "action/actual"

The test above can be thought of as symbolizing/testing the following expression:

  • add(1,2) === 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment