Javascript: Assertion Testing Function Example