Aggregating and running the application tests

Finishing up the test driver page for both the collection and view tests, we integrate the necessary script includes and HTML test fixtures in chapters/03/test/test.html (shown in the relevant part in the following code snippet):

<head>
  <!-- ... snipped ... -->

  <!-- Test libraries. -->
  <script src="js/lib/mocha.js"></script>
  <script src="js/lib/chai.js"></script>
  <script src="js/lib/sinon.js"></script>

  <!-- JavaScript Core Libraries -->
  <script src="../app/js/lib/underscore.js"></script>
  <!-- ... snipped ... -->

  <!-- JavaScript Application Libraries -->
  <script src="../app/js/app/namespace.js"></script>
  <script src="../app/js/app/config.js"></script>
  <script>
    // Test overrides (before any app components).
    App.Config = _.extend(App.Config, {
      storeName: "notes-test" // localStorage for tests.
    });
  </script>
  <script src="../app/js/app/models/note.js"></script>
  <script src="../app/js/app/collections/notes.js"></script>
  <script src="../app/js/app/templates/templates.js"></script>
  <script src="../app/js/app/views/note-view.js"></script>

  <!-- Test Setup -->
  <script>
    var expect = chai.expect;
    mocha.setup("bdd");

    window.onload = function () {
      mocha.run();
    };
  </script>

  <!-- Tests. -->
  <script src="js/spec/collections/notes.spec.js"></script>
  <script src="js/spec/views/note-view.spec.js"></script>
</head>
<body>
  <div id="mocha"></div>

  <!-- Test Fixtures. -->
  <div id="fixtures"
       style="display: none; visibility: hidden;"></div>
</body>

Opening a web browser to chapters/03/test/test.html, we can see the full test report for the collection and view:

Aggregating and running the application tests

Test report

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.61.142