public
Description: Simple project setup to let you test jsunit, JSSpec and Screw Unit against the same javascript model classes.
Homepage: http://www.brokenbuild.com/blog
Clone URL: git://github.com/wesmaldonado/test-driven-javascript-example-application.git
100644 24 lines (23 sloc) 0.793 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<html>
 <head>
<title>Test Page for Cat</title>
<script language="javascript" src="/js-common/jsunit/app/jsUnitCore.js"></script>
<script language="javascript" src="/javascripts/cat.js"></script>
</head>
<body>
  <script language="javascript">
     // start server: ruby example-app.rb -p 10000
     // go to: http://localhost:10000/js-common/jsunit/testRunner.html?1234
     // run via: localhost:10000/jsunit/test_cat.html
     function testCanCreateNewCat() {
        assertNotNull("The cat exists.", new Cat('fluffy'));
     }
     function testCatHasAName(){
       assertEquals("Cat is named fluffy", "fluFffy", new Cat("fluffy").name);
     }
     function testCatCanMeow(){
       assertEquals("Cat meows", "meow", new Cat("fluffy").meow());
     }
  </script>
</body>
</html>