HTML and CSS Reference
In-Depth Information
Listing 3.7 Making sure certain files load first
server: http://localhost:4224
load:
- src/mylib.js
- src/*.js
- test/*.js
In order to test the configuration we need a sample project. We will revisit the
strftime example once again, so start by copying the strftime.js file into the src
directory. Then add the test case from Listing 3.8 in test/strftime _ test.js .
Listing 3.8 Date.prototype.strftime test with JsTestDriver
TestCase("strftimeTest", {
setUp: function () {
this.date = new Date(2009, 9, 2, 22, 14, 45);
},
tearDown: function () {
delete this.date;
},
"test %Y should return full year": function () {
var year = Date.formats.Y(this.date);
assertNumber(year);
assertEquals(2009, year);
},
"test %m should return month": function () {
var month = Date.formats.m(this.date);
assertString(month);
assertEquals("10", month);
},
"test %d should return date": function () {
assertEquals("02", Date.formats.d(this.date));
},
"test %y should return year as two digits": function () {
assertEquals("09", Date.formats.y(this.date));
},
 
Search WWH ::




Custom Search