1 function verify_interface(name, instance, attributes) {
2 assert_true(name in self,
3 name + ' should be an defined type');
5 assert_true(instance instanceof self[name],
6 instance + ' should be an instance of ' + name);
7 Object.keys(attributes || {}).forEach(function(attribute) {
8 var type = attributes[attribute];
9 assert_true(attribute in instance,
10 attribute + ' should be an attribute of ' + name);
11 assert_equals(typeof instance[attribute], type,
12 attribute + ' should be of type ' + type);