Example of an untestable implementation replaced by a testable one.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
spec
src
vendor/jasmine-standalone/lib/jasmine-1.0.2
GPL.txt
LICENSE.md
README.md

README.md

This is an example of a function which has an untestable extra responsibility. That responsibility is extracted into a separate function and suddenly everything is testable.

In ./spec there are three different specs:

  • camelize-no-cache.html: Spec for the camelize() function with no cache.
  • camelize-hidden-cache.html: Spec for the camelize() function with an untestable internal cache.
  • camelize-visible-cache.html: Spec for a camelize() function created from the original camelize() function via a caching wrapper.