Permalink
Browse files

start on tests

  • Loading branch information...
1 parent f205cf1 commit dba6b073d6cb8f99c4dbc81057a39246f9370a40 @nathanielksmith committed Aug 31, 2012
Showing with 29 additions and 0 deletions.
  1. +29 −0 tests/test.js
View
@@ -0,0 +1,29 @@
+var Mock = require('../lib/akeley').Mock;
+
+exports.test_object_spec = {
+ setUp: function(cb) { cb() },
+ test_combined: function(test) {
+ var cat = {
+ name: 'unix',
+ vitals: {
+ age: 6,
+ colours: ['orange', 'black', 'brown'],
+ },
+ speak: function() { return "my name is " + this.name },
+ abilities: {
+ sit: function() { return "sat" },
+ sleep: function() { return "zzz" }
+ },
+
+ };
+ var mock_cat = new Mock(cat);
+ test.equal(mock_cat.name, 'unix', 'name is set');
+ test.equal(mock_cat.vitals.age, 6, 'age is set');
+ test.deepEqual(mock_cat.vitals.colours, ['orange', 'black', 'brown'], 'colours is set');
+ test.equal(mock_cat.speak.calls, 0, 'function mocked');
+ test.equal(mock_cat.abilities.sit.calls, 0, 'function mocked');
+ test.equal(mock_cat.abilities.sleep.calls, 0, 'function mocked');
+
+ test.done();
+ }
+};

0 comments on commit dba6b07

Please sign in to comment.