javascriptjqueryequalsassertjavascriptmvc

What is JavascriptMVC's assertEqual function?


I'm a total noob to JavascriptMVC so I'm going through the tutorials. But I have to say something that I'm sure is very simple is totally confusing me. In some of thier tutorials they reference a function assertEqual(). Whenever I try to run this in a dev environment my debug tools tell me it can't find the assertEqual function. What am I missing? Here's a link to an example of where they use assertEqual:

http://javascriptmvc.com/docs.html#!mvc.class

The first reference to it is in the code under the Instantiation sub heading. Thanks!


Solution

  • They are just writing bad examples. It's supposed to illustrate that something is equal to something else.

    A naive implementation of assertEqual would be

    function assertEqual(a, b) {
      if (a !== b) {
        throw new Error('values are not equal');
      }
    }